Skip to content

feat: add postgresql:// scheme as alias for asyncpg#2154

Open
r266-tech wants to merge 1 commit intotortoise:developfrom
r266-tech:fix/postgresql-scheme-alias
Open

feat: add postgresql:// scheme as alias for asyncpg#2154
r266-tech wants to merge 1 commit intotortoise:developfrom
r266-tech:fix/postgresql-scheme-alias

Conversation

@r266-tech
Copy link

Summary

Adds postgresql:// as a supported database URL scheme, aliasing to the asyncpg backend — matching the behavior of postgres://.

The official PostgreSQL documentation lists both postgres:// and postgresql:// as valid connection URIs, and pydantic's PostgresDsn already accepts both. Previously only postgres:// worked in Tortoise ORM.

Changes

  • tortoise/backends/base/config_generator.py: Added postgresql to urlparse.uses_netloc, DB_LOOKUP aliases, and the password-null check
  • tests/backends/test_db_url.py: Added postgresql to _postgres_scheme_engines dict so all existing postgres scheme tests run against it

Related Issue

Fixes #2147

The official PostgreSQL documentation lists both postgres:// and postgresql://
as valid connection URIs. Previously only postgres:// worked; this adds
postgresql:// as a supported scheme alias.

Fixes tortoise#2147
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 25, 2026

Merging this PR will not alter performance

✅ 24 untouched benchmarks


Comparing r266-tech:fix/postgresql-scheme-alias (370061e) with develop (e272ab0)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unknown DB scheme: postgresql

1 participant