swh.provenance.backend.postgresql module#

class swh.provenance.backend.postgresql.Db(conn: Connection[Any], pool: ConnectionPool | None = None)[source]#

Bases: BaseDb

PostgreSQL backend for the Software Heritage provenance index.

create a DB proxy

Parameters:
  • conn – psycopg connection to the SWH DB

  • pool – psycopg pool of connections

class swh.provenance.backend.postgresql.PostgresqlProvenance(db: str | Connection[Any], min_pool_conns: int = 1, max_pool_conns: int = 10)[source]#

Bases: object

current_version: int = 1#
get_db() Db[source]#
put_db(db: Db)[source]#
db()[source]#
check_config(*, check_write: bool) bool[source]#
whereis(swhid: CoreSWHID) QualifiedSWHID | None[source]#
whereare(*, swhids: List[CoreSWHID]) List[QualifiedSWHID | None][source]#

Given a list SWHID return a list of provenance info:

See whereis documentation for details on the provenance info.