fix: name psycopg2 in the Alembic DSN and cap sqlalchemy below 2.1 - #39
Merged
Merged
Conversation
…QLAlchemy 2.1 deprecation
… integrity errors
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 #38. Follow-up to lift the cap: #40.
What
Settings.sync_db_dsn_parsedsetsdrivername="postgresql+psycopg2"instead of"postgresql"; the test that pinned the old value now pins the driver.sqlalchemy[asyncio]<2.1.Why
SQLAlchemy 2.1.1 (2026-09-25) arrived through the fresh resolve and broke the pytest jobs in three independent ways:
postgresql://now means psycopg (3), soalembic upgrade headimported a driver this project does not depend on. Naming the driver fixes the URL's meaning regardless of SQLAlchemy's default (option 1 from CI: pytest jobs fail on a fresh resolve because SQLAlchemy 2.1 resolves postgresql:// to psycopg 3 #38; psycopg 3 is a separate decision).DETAILline that 2.1 no longer includes (Bug: DuplicateKeyError not raised on SQLAlchemy 2.1 with asyncpg (regex no longer matches) litestar-org/advanced-alchemy#803, fix PR open). Duplicate username and unknown member id return 500 instead of 409/400. Confirmed independent of anything here by running the suite on 2.1.1 with this repo's models untouched.filterwarnings = ["error"]: advanced-alchemy's@declarative_mixin(#804) and this repo'slazy="noload".(2) has no fix on our side, so the cap is the honest change; (3) is recorded in #40 with the verified replacement (
lazy="raise"), to land when the cap lifts.Verified
test_sync_db_dsn_parsed_names_the_sync_driverfails against the olddrivername('postgresql' == 'postgresql+psycopg2'), green after the settings change.