Skip to content

Commit

Permalink
Merge branch 'master' into fix_issue280
Browse files Browse the repository at this point in the history
  • Loading branch information
xzkostyan authored Feb 17, 2024
2 parents af57e63 + 24e8b35 commit cb29028
Show file tree
Hide file tree
Showing 103 changed files with 33,268 additions and 8,677 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[flake8]
filename = *.py, *.pyx
exclude = perf
per-file-ignores =
clickhouse_driver/columns/largeint.pyx: E225, E226, E227, E999
clickhouse_driver/bufferedreader.pyx: E225, E226, E227, E999
Expand Down
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
patreon: xzkostyan

21 changes: 21 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
Link to relevant issues or previous PRs, one per line. Use "fixes" to
automatically close an issue.
-->

- fixes #<issue number>

<!--
Ensure each step in CONTRIBUTING.rst is complete by adding an "x" to
each box below.
If only docs were changed, these aren't relevant and can be removed.
-->

Checklist:

- [ ] Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
- [ ] Add or update relevant docs, in the docs folder and in code.
- [ ] Ensure PR doesn't contain untouched code reformatting: spaces, etc.
- [ ] Run `flake8` and fix issues.
- [ ] Run `pytest` no tests failed. See https://clickhouse-driver.readthedocs.io/en/latest/development.html.
40 changes: 24 additions & 16 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@ on: [push, pull_request]
name: build
jobs:
tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
use-numpy:
- 0
python-version:
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "pypy-3.6"
- "pypy-3.7"
clickhouse-version:
- 23.9.3.12
- 23.2.6.34
- 22.9.5.25
- 22.2.3.5
- 21.12.3.32
- 21.9.3.30
- 21.9.3.30
- 21.4.6.55
- 21.3.10.1
- 21.2.10.48
Expand All @@ -38,7 +41,6 @@ jobs:
- 19.9.2.4 # allow_suspicious_low_cardinality_types
- 19.8.3.8 # SimpleAggregateFunction
- 19.3.3
- 18.12.17
include:
- clickhouse-version: 20.3.20.6
use-numpy: 1
Expand Down Expand Up @@ -66,11 +68,12 @@ jobs:
- name: Start ClickHouse server and client containers
run: |
echo "VERSION=${{ matrix.clickhouse-version }}" > tests/.env
if [[ "${{ matrix.clickhouse-version }}" > "21.7" ]]; then echo "ORG=clickhouse"; else echo "ORG=yandex" ; fi >> tests/.env
docker-compose -f tests/docker-compose.yml up -d
- name: Setup clickhouse-client proxy for docker
run: |
# Faking clickhouse-client real communication with container via docker exec.
echo -e '#!/bin/bash\n\ndocker exec -e "`env | grep ^TZ=`" test-clickhouse-client clickhouse-client "$@"' | sudo tee /usr/local/bin/clickhouse-client > /dev/null
echo -e '#!/bin/bash\n\ndocker exec -e "`env | grep ^TZ=`" test-clickhouse-client clickhouse client "$@"' | sudo tee /usr/local/bin/clickhouse-client > /dev/null
sudo chmod +x /usr/local/bin/clickhouse-client
# Overriding setup.cfg. Set host=clickhouse-server
sed -i 's/^host=localhost$/host=clickhouse-server/' setup.cfg
Expand All @@ -91,7 +94,7 @@ jobs:
env:
USE_NUMPY: ${{ matrix.use-numpy }}
- name: Run tests
run: coverage run -m py.test --timeout=10 -v
run: coverage run -m pytest --timeout=10 -v
timeout-minutes: 5
env:
# Set initial TZ for docker exec -e "`env | grep ^TZ`"
Expand All @@ -117,7 +120,7 @@ jobs:
valgrind:
name: Valgrind check
needs: tests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand All @@ -126,7 +129,7 @@ jobs:
python-version: 3.8
architecture: x64
- name: Install valgrind
run: sudo apt-get install -y valgrind
run: sudo apt-get update && sudo apt-get install -y valgrind
# - name: Login to Docker Hub
# uses: docker/login-action@v1
# with:
Expand All @@ -135,6 +138,7 @@ jobs:
- name: Start ClickHouse server and client containers
run: |
echo "VERSION=$VERSION" > tests/.env
if [[ "$VERSION" > "21.7" ]]; then echo "ORG=clickhouse"; else echo "ORG=yandex" ; fi >> tests/.env
docker-compose -f tests/docker-compose.yml up -d
env:
VERSION: 20.3.7.46
Expand Down Expand Up @@ -164,7 +168,7 @@ jobs:
wheels-linux:
name: Wheels for Linux
needs: valgrind
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand All @@ -182,7 +186,7 @@ jobs:
pip install --upgrade pip setuptools
pip install cython cibuildwheel==$VERSION
env:
VERSION: 2.2.2
VERSION: 2.16.2
- name: Build wheels
run: cibuildwheel --output-dir wheelhouse
env:
Expand All @@ -201,7 +205,7 @@ jobs:
wheels-macos:
name: Wheels for OS X
needs: valgrind
runs-on: macos-10.15
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand All @@ -219,12 +223,13 @@ jobs:
pip install --upgrade pip setuptools
pip install cython cibuildwheel==$VERSION
env:
VERSION: 2.2.2
VERSION: 2.16.2
- name: Build wheels
run: cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: '*p3*'
CIBW_BEFORE_BUILD: pip install cython
CIBW_ARCHS_MACOS: x86_64 arm64
- uses: ncipollo/release-action@v1
name: Upload wheels
if: ${{ github.ref_type == 'tag' }}
Expand All @@ -240,6 +245,9 @@ jobs:
needs: valgrind
runs-on: windows-2019
steps:
- name: Set git to use repo line breaks
run: |
git config --global core.autocrlf false
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
Expand All @@ -255,7 +263,7 @@ jobs:
run: |
pip install cibuildwheel==$env:VERSION
env:
VERSION: 2.2.2
VERSION: 2.16.2
- name: Build wheels
run: cibuildwheel --output-dir wheelhouse
env:
Expand All @@ -274,7 +282,7 @@ jobs:
wheels-linux-non-x86:
name: Wheels for Linux non-x86
needs: valgrind
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
arch:
Expand Down Expand Up @@ -304,7 +312,7 @@ jobs:
pip install --upgrade pip setuptools
pip install cibuildwheel==$VERSION
env:
VERSION: 2.2.2
VERSION: 2.16.2
- name: Build wheels
run: cibuildwheel --output-dir wheelhouse
env:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on: [push, pull_request]
name: build-docs
jobs:
tests:
runs-on: ubuntu-22.04
name: Build docs
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
architecture: x64
- name: Update tools
run: pip install --upgrade pip setuptools wheel
- name: Install sphinx
run: pip install sphinx
- name: Install package
run: pip install -e .
- name: Build docs
run: cd docs && make html
14 changes: 14 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

sphinx:
configuration: docs/conf.py

python:
install:
- method: pip
path: .
94 changes: 92 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,92 @@
# Changelog

## Unreleased
### Fixed
- Memory leak when clickhouse raise exception onBufferedSocketWriter.write_into_stream. Solves issue [#406](https://github.com/mymarilyn/clickhouse-driver/issues/406).

## [0.2.6] - 2023-05-02
### Added
- JSON type. Solves issue [#320](https://github.com/mymarilyn/clickhouse-driver/issues/300).
- On demand client revision downgrading.
- Server-side query templating.
- Sparse data type deserialization.
- TCP keepalive.
- [NumPy] Optional dataframe column names replacing. Pull request [#361](https://github.com/mymarilyn/clickhouse-driver/pull/361) by [notsovitalik](https://github.com/notsovitalik).
- Substitution for parameters with time type. Solves issue [#359](https://github.com/mymarilyn/clickhouse-driver/issues/359). Pull request [#360](https://github.com/mymarilyn/clickhouse-driver/pull/360) by [ghazi-git](https://github.com/ghazi-git).

### Fixed
- Client construction with round_robin. Solves issue [#373](https://github.com/mymarilyn/clickhouse-driver/issues/373).
- Column state prefixes reading and writing. Solves issue [#372](https://github.com/mymarilyn/clickhouse-driver/issues/372).
- Inserts to a nullable LowCardinality columns. Solves issue [#363](https://github.com/mymarilyn/clickhouse-driver/issues/363). Pull request [#366](https://github.com/mymarilyn/clickhouse-driver/pull/366) by [Dmitry-k42](https://github.com/Dmitry-k42).
- [NumPy] Avoid unnecessary timezone conversion. Solves issue [#354](https://github.com/mymarilyn/clickhouse-driver/issues/354). Pull request [#355](https://github.com/mymarilyn/clickhouse-driver/pull/355) by [edwinwzhe](https://github.com/edwinwzhe).

### Changed
- Protocol version bumped to 54459.
- [NumPy] Speed-up reading Datetime64. Pull request [#365](https://github.com/mymarilyn/clickhouse-driver/pull/365) by [joelgibson](https://github.com/joelgibson).

### Removed
- Python 3.6 support.

## [0.2.5] - 2022-11-27
### Added
- [NumPy] More readable exception for less columns in frame. Solves issue [#320](https://github.com/mymarilyn/clickhouse-driver/issues/320).
- Support `server_hostname` via SNI when connecting. Pull request [#325](https://github.com/mymarilyn/clickhouse-driver/pull/325) by [dspangen](https://github.com/dspangen).
- [NumPy] Bool support. Pull request [#332](https://github.com/mymarilyn/clickhouse-driver/pull/332) by [DylanModesitt](https://github.com/DylanModesitt).
- Multiple connections round-robin.
- Wheels for Python 3.11.
- Docstring for `substitute_params`. Pull request [#347](https://github.com/mymarilyn/clickhouse-driver/pull/347) by [jasonho-lynx](https://github.com/jasonho-lynx).

### Fixed
- Decimal support inside Map type. Pull request [#297](https://github.com/mymarilyn/clickhouse-driver/pull/297) by [zaius](https://github.com/zaius).
- Preserve empty dataframe shape. Solves issue [#321](https://github.com/mymarilyn/clickhouse-driver/issues/321).
- Preserve nanoseconds on INSERT for DateTime64. Solves issue [#307](https://github.com/mymarilyn/clickhouse-driver/issues/307).
- Handle "progress" packets while inserting. Solves issue [#326](https://github.com/mymarilyn/clickhouse-driver/issues/326). Pull request [#327](https://github.com/mymarilyn/clickhouse-driver/pull/327) by [carlosfy](https://github.com/carlosfy).
- [NumPy] Don't raise exception on INSERT when dataframe columns are superset of table's. Pull request [#340](https://github.com/mymarilyn/clickhouse-driver/pull/340) by [andrewresnikoff](https://github.com/andrewresnikoff).
- Re-cythonize files for Python 3.11. Pull request [#342](https://github.com/mymarilyn/clickhouse-driver/pull/342) by [asottile-sentry](https://github.com/asottile-sentry).
- NULL defaults to empty Array instead of one-element array. Solves issue [#339](https://github.com/mymarilyn/clickhouse-driver/issues/339).
- Handle "profile event" packets while inserting.

### Removed
- Python 3.5 support.

## [0.2.4] - 2022-06-13
### Added
- ``dict`` and ``namedtuple`` cursor factories. Solves issue [#290](https://github.com/mymarilyn/clickhouse-driver/issues/290).
- Geo types: Point, Ring, Polygon, MultiPolygon. Solves issue [#228](https://github.com/mymarilyn/clickhouse-driver/issues/228).
- [NumPy] Tuple type.
- ``input_format_null_as_default`` option for NULL insert into not NULL columns. Solves issue [#312](https://github.com/mymarilyn/clickhouse-driver/issues/312).
- Chunk size controlling in ``execute_iter`` by parameter ``chunk_size``. Solves issue [#314](https://github.com/mymarilyn/clickhouse-driver/issues/314). Pull request [#315](https://github.com/mymarilyn/clickhouse-driver/pull/315) by [MIracleyin](https://github.com/MIracleyin).

### Fixed
- Decimal precision check on INSERT. Solves issue [#289](https://github.com/mymarilyn/clickhouse-driver/issues/289). Pull request [#295](https://github.com/mymarilyn/clickhouse-driver/pull/295) by [joelynch](https://github.com/joelynch).
- Using server's default database instead or ``default``. Solves issue [#309](https://github.com/mymarilyn/clickhouse-driver/issues/309).
- ``python_requires`` to valid PEP 440 syntax in ``setup.py``. Pull request [#291](https://github.com/mymarilyn/clickhouse-driver/pull/291) by [LSturtew](https://github.com/LSturtew).

### Changed
- Protocol version bumped to 54453.

## [0.2.3] - 2022-02-07
### Added
- `tzlocal`>=4.0 support. Pull request [#263](https://github.com/mymarilyn/clickhouse-driver/pull/263) by [azat](https://github.com/azat).
- `quota_key` support.
- Wheels for Python 3.10.
- Bool type. Pull request [#279](https://github.com/mymarilyn/clickhouse-driver/pull/279) by [adrian17](https://github.com/adrian17).
- Nested type with `flatten_nested=0`. Pull request [#285](https://github.com/mymarilyn/clickhouse-driver/pull/285) by [spff](https://github.com/spff).

### Fixed
- Handle partially consumed query. Solves issue [#117](https://github.com/mymarilyn/clickhouse-driver/issues/117).
- Fallback to generic columns when NumPy support is not implemented for column type. Solves issue [#254](https://github.com/mymarilyn/clickhouse-driver/issues/254).
- Broken ZSTD decompression. Solves issue [#269](https://github.com/mymarilyn/clickhouse-driver/issues/269).
- External tables passing with NumPy. Solves issue [#267](https://github.com/mymarilyn/clickhouse-driver/issues/267).
- Consider tzinfo for datetime parameters substitution. Solves issue [#268](https://github.com/mymarilyn/clickhouse-driver/issues/268).
- Do not use NumPy columns inside generic columns. Solves issue [#272](https://github.com/mymarilyn/clickhouse-driver/issues/272).
- Decimal128 and Decimal256 types_check. Solves issue [#274](https://github.com/mymarilyn/clickhouse-driver/issues/274).
- Insertion using `execute` in DB API. Solves issue [#179](https://github.com/mymarilyn/clickhouse-driver/issues/179). Pull request [#276](https://github.com/mymarilyn/clickhouse-driver/pull/276) by [nnseva](https://github.com/nnseva).
- Variables cannot be declared with `cpdef` in Cython 3. Pull request [#281](https://github.com/mymarilyn/clickhouse-driver/pull/281) by [ym](https://github.com/ym).

### Changed
- Switch from nose test runner to pytest.
- Migrate from Travis CI to GitHub Actions.

## [0.2.2] - 2021-09-24
### Added
Expand All @@ -9,7 +95,7 @@
- OpenTelemetry support. Solves issue [#230](https://github.com/mymarilyn/clickhouse-driver/issues/230).
- `tzlocal`>=3.0 support.
- Date32 type.
- NumPy Nullable(T) support.
- [NumPy] Nullable(T) support.

### Fixed
- Boxing on DataFrames INSERT.
Expand Down Expand Up @@ -359,7 +445,11 @@
- Date/DateTime types.
- String types.

[Unreleased]: https://github.com/mymarilyn/clickhouse-driver/compare/0.2.2...HEAD
[Unreleased]: https://github.com/mymarilyn/clickhouse-driver/compare/0.2.6...HEAD
[0.2.6]: https://github.com/mymarilyn/clickhouse-driver/compare/0.2.5...0.2.6
[0.2.5]: https://github.com/mymarilyn/clickhouse-driver/compare/0.2.4...0.2.5
[0.2.4]: https://github.com/mymarilyn/clickhouse-driver/compare/0.2.3...0.2.4
[0.2.3]: https://github.com/mymarilyn/clickhouse-driver/compare/0.2.2...0.2.3
[0.2.2]: https://github.com/mymarilyn/clickhouse-driver/compare/0.2.1...0.2.2
[0.2.1]: https://github.com/mymarilyn/clickhouse-driver/compare/0.2.0...0.2.1
[0.2.0]: https://github.com/mymarilyn/clickhouse-driver/compare/0.1.5...0.2.0
Expand Down
2 changes: 1 addition & 1 deletion clickhouse_driver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .dbapi import connect


VERSION = (0, 2, 2)
VERSION = (0, 2, 7)
__version__ = '.'.join(str(x) for x in VERSION)

__all__ = ['Client', 'connect']
Loading

0 comments on commit cb29028

Please sign in to comment.