Skip to content

Add support for postgresql+psycopg as allowed scheme to use with PostgreDsn #4689

@morian

Description

@morian

Initial Checks

  • I have searched Google & GitHub for similar requests and couldn't find anything
  • I have read and followed the docs and still think this feature is missing

Description

SQLAlchemy 2.0 (currently in beta) now supports psycopg (a.k.a. psycopg3).

This was introduced as a new dialect by the following commit:
sqlalchemy/sqlalchemy@5eb407f

The connection string appears to be postgresql+psycopg://user:password@host:port/dbname[?key=value&key=value...] but unfortunately it is not recognized by pydantic as a valid scheme by PostgresDsn from networks.py.

Would it be possible to add it as an allowed scheme for PostgresDsn?

By looking at the code and while not familiar with cockroachdb, it seems like it would also benefit from this support:
https://www.cockroachlabs.com/docs/stable/build-a-python-app-with-cockroachdb-psycopg3.html

Thanks!

Affected Components

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions