Skip to content

common_auth.stores.postgres

PostgreSQL persistence with committed pending markers and session guards.

Classes

PostgresStore

Bases: BaseStore

Protected versioned records using an owned or supplied async psycopg pool.

Carries configuration, pool ownership and an injected protector. Opening creates connections only for an owned pool; initialize() explicitly creates the version-one schema/table. Reads never create or migrate tables.

Every writer takes a session advisory lock on its checked-out connection. Writes autocommit, including pending before an external issuer call; the lock may span that call without an open SQL transaction. Loss of the process releases the lock while its committed pending marker continues blocking automatic renewal. Connection/account/grant keys are encoded independently.

__init__

def __init__(config: PostgresStoreConfig | Mapping[str, object] | None = None, *, protector: Protector, pool: Any = None) -> None

Fields and properties declared here; inherited members belong to the bases above.

config

config = config if isinstance(config, PostgresStoreConfig) else PostgresStoreConfig.model_validate(config or {})

owns_pool

Read-only property.

owns_pool: bool

initialize

async def initialize() -> None

Explicit, idempotent creation of this store’s version-one SQL layout.