Pep249#159
Draft
danhogue wants to merge 15 commits into
Draft
Conversation
- docs/pep249_requirements.md: full PEP 249 spec reference including module globals, exception hierarchy, type objects, connection/cursor interface, and SQLAlchemy-specific requirements beyond base PEP 249 - docs/pep249_implementation_plan.md: gap analysis against the current asynch codebase with prioritised implementation suggestions for each missing or incorrect item (apilevel/threadsafety/paramstyle, connect(), type singletons, arraysize, setoutputsize, lastrowid, callproc, nextset, description type_code, commit no-op) - tests/pep249/: TDD suite covering every PEP 249 requirement (module globals, exceptions, type objects, connection lifecycle, cursor attributes/methods, execute/executemany, fetch semantics, description format and type_code mapping) - tests/sqlalchemy/: compatibility suite verifying asynch provides the exact DB-API interface SQLAlchemy needs; Core and ORM tests skip gracefully when clickhouse-sqlalchemy is not installed - Makefile: add test-pep249, test-sqlalchemy, test-compat targets that show all failures at once (suitable for TDD workflow) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The DSN parser was using enum objects directly in string sets instead of their values, causing scheme validation failures when enums were used in f-strings. Changes: - asynch/proto/utils/dsn.py: Use .value for enum string sets and comparisons - asynch/proto/connection.py: Fix alt_hosts URL construction with enum.value - tests/test_proto/utils/test_dsn.py: Fix test DSN construction to use .value The bug was introduced in commit 23da5d6 (Oct 2024) when enum imports were updated but the string sets weren't updated to use .value. Fixes test failures in DSN parsing and ensures proper URL scheme validation.
Reduce max_threads test from 1234 to 4 to work with 2-core Docker container. ClickHouse auto-caps threads based on available cores, causing test failures with unrealistic values. Test functionality remains unchanged.
- Add module globals: apilevel=2.0, threadsafety=1, paramstyle=pyformat - Implement module-level connect() factory function with full parameter support - Export all PEP 249 exceptions (Warning, Error, DatabaseError, etc.) - Create asynch/dbapi_types.py with comprehensive type system: - Type objects: STRING, NUMBER, DATETIME, BINARY, ROWID - Type constructors: Date, Time, Timestamp, DateFromTicks, etc. - ClickHouse to PEP 249 type mapping with Nullable/LowCardinality support - Add missing cursor methods and properties: - cursor.arraysize public property with getter/setter - cursor.setoutputsize() (renamed from setoutputsizes, kept alias) - cursor.lastrowid property (returns None for ClickHouse) - cursor.callproc() method (raises NotSupportedError per spec) - cursor.nextset() async method (returns None for single result sets) - Fix cursor.description to use PEP 249 type objects and return None for non-SELECT - Change connection.commit() from raising NotSupportedError to no-op behavior - Fix cursor and connection __repr__ methods to show clean status strings
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.
No description provided.