Add SQLAlchemy dialects incl. psycopg 3 support (#3) - #8
Closed
jmitchel3 wants to merge 2 commits into
Closed
Conversation
The sqlalchemy.dialects entry points in pyproject.toml pointed at timescaledb.dialect:Timescaledb*Dialect, but that module never existed, so timescaledb:// URLs could not resolve. - Add src/timescaledb/dialect.py defining TimescaledbPsycopg2Dialect, TimescaledbPsycopgDialect (psycopg 3) and TimescaledbAsyncpgDialect as thin subclasses of the matching PostgreSQL dialects. Each sets supports_statement_cache = True to keep SQLAlchemy query caching enabled. - Register the missing timescaledb.psycopg entry point for psycopg 3. - Add tests covering URL resolution and PostgreSQL subclassing. - Document the timescaledb:// driver schemes in the README.
|
Closed as already incorporated into main. Current main includes the TimescaleDB SQLAlchemy dialect module, the timescaledb/psycopg2/psycopg/asyncpg entry points, the README driver docs, and tests/test_dialect.py. The remaining PR branch is stale against main and conflict-only at this point. |
Owner
Author
|
Closed as already incorporated into main. Current main includes the TimescaleDB SQLAlchemy dialect module, the timescaledb/psycopg2/psycopg/asyncpg entry points, README driver docs, and tests/test_dialect.py. The remaining PR branch is stale/conflicting against main. |
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.
Closes #3.
Problem
pyproject.tomlregisteredsqlalchemy.dialectsentry points pointing attimescaledb.dialect:Timescaledb*Dialect, but that module never existed. As reported in #3, theTimescaledb*Dialectclasses could not be found, andtimescaledb://connection URLs could not resolve. There was also nopsycopg(psycopg 3) dialect at all.Changes
src/timescaledb/dialect.py(new) — definesTimescaledbPsycopg2Dialect,TimescaledbPsycopgDialect(psycopg 3), andTimescaledbAsyncpgDialectas thin subclasses of the matching PostgreSQL dialects. This library manages hypertables via explicit helper functions rather than DDL-compiler hooks, so the dialects only need to map thetimescaledbscheme to the right driver. Each setssupports_statement_cache = Trueso SQLAlchemy query caching stays enabled.pyproject.toml— registers the missingtimescaledb.psycopgentry point for psycopg 3.tests/test_dialect.py(new) — covers URL resolution for all four schemes and PostgreSQL subclassing.README.md— documents thetimescaledb://driver schemes.timescaledb://TimescaledbPsycopg2Dialecttimescaledb+psycopg2://TimescaledbPsycopg2Dialecttimescaledb+psycopg://TimescaledbPsycopgDialecttimescaledb+asyncpg://TimescaledbAsyncpgDialectTesting
timescaledb+psycopg://against atimescale/timescaledb:latest-pg17container connected successfully (TimescaleDB ext 2.28.1).Note
A new release (e.g.
0.0.7) is needed before users get the new entry points from PyPI.