add PEP 249 DB API constructors - #940
Merged
Merged
Conversation
joe-clickhouse
requested review from
Copilot
and removed request for
peter-leonov-ch
August 6, 2026 00:04
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the PEP 249 constructor surface for clickhouse_connect.dbapi by adding Binary, Date, Time, Timestamp, plus the *FromTicks helpers. This resolves SQLAlchemy LargeBinary binding failures where the dialect expects dbapi.Binary to exist.
Changes:
- Add PEP 249 type constructors and
*FromTicksfunctions toclickhouse_connect.dbapi. - Add unit tests covering constructors and verifying SQLAlchemy’s
import_dbapi()exposesBinary. - Update documentation and changelog to reflect the DB-API surface addition.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
clickhouse_connect/dbapi/__init__.py |
Adds PEP 249 constructors (Binary, Date, Time, Timestamp) and tick-based constructor functions. |
tests/unit_tests/test_driver/test_dbapi_types.py |
New unit tests validating constructor behavior and SQLAlchemy dialect consumption. |
docs/driver-api.mdx |
Documents the newly supported PEP 249 constructors and tick helpers. |
CHANGELOG.md |
Adds a user-visible bugfix entry referencing the SQLAlchemy LargeBinary binding fix and issue #919. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Binary,Date,Time,Timestamp, and*FromTicksconstructors.LargeBinaryinserts raisingAttributeErrorwhen the dialect callsdbapi.Binary.LargeBinaryread behavior for separate work.Co-authored by @sankalpsthakur
Checklist
Delete items not relevant to your PR: