sage.database.postgres_backends package¶
Subpackages¶
Submodules¶
sage.database.postgres_backends.connector module¶
-
class
sage.database.postgres_backends.connector.
PostgresConnector
(table_name: str, dbname: str, user: str, password: str, host: str = '', port: int = 5432, fetch_size: int = 500)¶ Bases:
sage.database.db_connector.DatabaseConnector
A PostgresConnector search for RDF triples in a PostgreSQL database.
- Args:
table_name: Name of the SQL table containing RDF data.
dbname: the database name.
user: user name used to authenticate.
password: password used to authenticate.
host: database host address (defaults to UNIX socket if not provided).
port: connection port number (defaults to 5432 if not provided).
fetch_size: The number of SQL rows/RDF triples to fetch per batch (defaults to 500).
-
abort_transaction
() → None¶ Abort any ongoing transaction
-
close
() → None¶ Close the database connection
-
commit_transaction
() → None¶ Commit any ongoing transaction
-
open
() → None¶ Open the connection to the PostgreSQL database and initialize histograms.
-
start_transaction
() → None¶ Start a PostgreSQL transaction
sage.database.postgres_backends.transaction_manager module¶
-
class
sage.database.postgres_backends.transaction_manager.
TransactionManager
(dbname: str, user: str, password: str, host: str = '', port: int = 5432)¶ Bases:
object
A TransactionManager handles transactions for a (MVCC-)PostgreSQL connector.
- Args:
dbname: the database name.
user: user name used to authenticate.
password: password used to authenticate.
host: database host address (defaults to UNIX socket if not provided).
port: connection port number (defaults to 5432 if not provided).
-
abort
() → bool¶ Abort an ongoing transaction
-
close_all
() → None¶ Close all connections & rollback any ongoing transactions
-
close_connection
() → None¶ Close the connection for a given processs
-
commit
() → bool¶ Commit an ongoing transaction
-
get_connection
()¶ Get the connection of the current processs
-
is_open
() → bool¶ Returns True if the current process has an open connection to the DB
-
open_connection
() → None¶ Open a new connection for the given process
-
start_transaction
()¶ Starts a new transaction