Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ def db_dsn_parsed(self) -> URL:

@property
def sync_db_dsn_parsed(self) -> URL:
# Alembic drives psycopg2, not asyncpg.
return self.db_dsn_parsed.set(drivername="postgresql")
return self.db_dsn_parsed.set(drivername="postgresql+psycopg2")

@property
def api_bootstrapper_config(self) -> LitestarConfig:
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ dependencies = [
"alembic",
"alembic-postgresql-enum",
"psycopg2",
"sqlalchemy[asyncio]",
# <2.1 until advanced-alchemy translates 2.1 integrity errors (litestar-org/advanced-alchemy#803).
"sqlalchemy[asyncio]<2.1",
"asyncpg",
# tracing
"opentelemetry-instrumentation-asyncpg",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ def test_db_dsn_parsed_exposes_driver() -> None:
assert settings.db_dsn_parsed.database == "dbname"


def test_sync_db_dsn_parsed_drops_the_async_driver() -> None:
def test_sync_db_dsn_parsed_names_the_sync_driver() -> None:
settings = Settings(db_dsn="postgresql+asyncpg://user:pw@host/dbname")
assert settings.sync_db_dsn_parsed.drivername == "postgresql"
assert settings.sync_db_dsn_parsed.drivername == "postgresql+psycopg2"
assert settings.sync_db_dsn_parsed.database == "dbname"


Expand Down
Loading