sage.database.postgres_backends.postgres_mvcc package¶
Submodules¶
sage.database.postgres_backends.postgres_mvcc.connector module¶
sage.database.postgres_backends.postgres_mvcc.iterator module¶
sage.database.postgres_backends.postgres_mvcc.queries module¶
-
sage.database.postgres_backends.postgres_mvcc.queries.
get_delete_query
(table_name: str) → str¶ Build a SQL query to delete a RDF triple from a MVCC-PostgreSQL table.
Argument: Name of the SQL table from which the triple will be deleted.
Returns: A prepared SQL query that can be executed with a tuple (subject, predicate, object).
-
sage.database.postgres_backends.postgres_mvcc.queries.
get_insert_many_query
(table_name: str) → str¶ Build a SQL query to insert several RDF triples into a MVCC-PostgreSQL table.
Argument: Name of the SQL table in which the triples will be inserted.
Returns: A prepared SQL query that can be executed with a list of tuples (subject, predicate, object).
-
sage.database.postgres_backends.postgres_mvcc.queries.
get_insert_query
(table_name: str) → str¶ Build a SQL query to insert a RDF triple into a MVCC-PostgreSQL table.
Argument: Name of the SQL table in which the triple will be inserted.
Returns: A prepared SQL query that can be executed with a tuple (subject, predicate, object).
-
sage.database.postgres_backends.postgres_mvcc.queries.
get_resume_query
(subj: str, pred: str, obj: str, last_read: Tuple[str, str, str, datetime.datetime, datetime.datetime], table_name: str, symbol: str = '>=') → Tuple[str, str]¶ Get a prepared SQL query which resumes scanning for a triple pattern.
The SQL query rely on keyset pagination to resume query processing using an optimized Index Scan.
- Args:
subj: Subject of the triple pattern.
pred: Predicate of the triple pattern.
obj: Object of the triple pattern.
last_read: The SQL row from which to resume scanning.
table_name: Name of the SQL table to scan for RDF triples.
symbol: Symbol used to perform the keyset pagination. Defaults to “>=”.
- Returns:
A tuple with the prepared SQL query and its parameters.
-
sage.database.postgres_backends.postgres_mvcc.queries.
get_start_query
(subj: str, pred: str, obj: str, table_name: str) → Tuple[str, List[str]]¶ Get a prepared SQL query which starts scanning for a triple pattern.
- Args:
subj: Subject of the triple pattern.
pred: Predicate of the triple pattern.
obj: Object of the triple pattern.
table_name: Name of the SQL table to scan for RDF triples.
- Returns:
A tuple with the prepared SQL query and its parameters.