anyvar.storage.postgres

Provide PostgreSQL-based storage implementation.

class anyvar.storage.postgres.PostgresObjectStore(db_url, *args, **kwargs)[source]

PostgreSQL storage backend using dedicated ORM tables.

__init__(db_url, *args, **kwargs)[source]

Initialize PostgreSQL storage.

Parameters:

db_url (str) – Database connection URL (e.g., postgresql://user:pass@host:port/db)

close()[source]

Close the storage backend.

Return type:

None

delete_extensions(object_id, name=None, value=None)[source]

Delete extension(s) for an object

Supports gradual specificity – either delete all extensions, or delete all extensions under a given key/name, or delete all extensions with a given name AND value.

If no extension matching given args exists, do nothing.

Parameters:
  • object_id (str) – The object ID

  • name (str | None) – Optional extension key/name to delete

  • value (Optional[TypeAliasType]) – Optional extension value to delete. Ignored if name is not provided

Return type:

int

Returns:

Number of deleted rows

wait_for_writes()[source]

Wait for all background writes to complete. NOTE: This is a no-op for synchronous storage backends.

Return type:

None