swh.provenance.backend.postgresql module#

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

Bases: BaseDb

PostgreSQL backend for the Software Heritage provenance index.

create a DB proxy

Parameters:
  • conn – psycopg2 connection to the SWH DB

  • pool – psycopg2 pool of connections

class swh.provenance.backend.postgresql.PostgresqlProvenance(db, min_pool_conns=1, max_pool_conns=10)[source]#

Bases: object

current_version: int = 1#
get_db()[source]#
put_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.