httk.store.backend.postgresql.engine

PostgreSQL database construction for Backend.

Functions

database(cls, url, *[, database])

Build a PostgreSQL-backed backend from a postgresql:// URL.

Module Contents

httk.store.backend.postgresql.engine.database(cls, url, *, database=None)

Build a PostgreSQL-backed backend from a postgresql:// URL.

PostgreSQL is fully transactional and rides the existing "transactional" write profile with no special-casing. Only the psycopg 3 driver is supported: a bare postgresql:// URL is normalized to postgresql+psycopg:// (SQLAlchemy 2.0 would otherwise select psycopg2), and any other explicit driver is rejected.

Parameters:
  • cls (type[Backend]) – The backend class to instantiate.

  • url (str | sqlalchemy.URL) – PostgreSQL SQLAlchemy URL or URL string.

  • database (str | None) – The database name overriding the URL path, if supplied.

Returns:

The configured PostgreSQL backend wrapper.

Raises:
  • ImportError – If psycopg (psycopg 3) is not installed; install the httk-store[postgresql] extra to use Backend.postgresql().

  • ValueError – If the URL names a driver other than postgresql+psycopg (psycopg 3).

Return type:

httk.store.backend.sql.engine.Backend