Utilities#
Observability, quoting, adapters, memory and the DB-API.
Observability#
See Observability.
- agensgraph.add_query_logger(callback: Callable[[QueryRecord], None])#
Call
callbackwith aQueryRecordfor every statement.
- agensgraph.remove_query_logger(callback: Callable[[QueryRecord], None])#
- class agensgraph.QueryRecord(
- connection: int,
- statement: str,
- elapsed: float,
- rows: int,
- failed: bool,
- error: BaseException | None = None,
One statement.
- connection: int#
an opaque number for the connection
- statement: str#
as sent, without parameter values
- elapsed: float#
seconds until the server answered
- rows: int#
- failed: bool#
- error: BaseException | None#
- agensgraph.enable_tracing(tracer: Any = None)#
Take an OpenTelemetry span per
execute_query(). Needs theotelextra.
- agensgraph.disable_tracing()#
Quoting#
See Identifiers.
- agensgraph.cypher.quote_identifier(name: str) str#
A name as an identifier, quoted unless the server would read it unchanged.
- agensgraph.cypher.quote_string(value: str) str#
A string literal.
- agensgraph.cypher.check_single_statement(statement: str)#
Raise
ValueErrorif the text holds more than one statement.
- agensgraph.cypher.check_can_wrap(statement: str)#
Raise
ValueErrorif the text holds a write clause. A hint, not a boundary.
Adapters#
See Other tools.
- agensgraph.adapters.register_text(context: AdaptContext | AdaptersMap, labels: LabelCache | None = None)#
Read graph values in the text rendering on a psycopg connection, and send values the driver’s way.
- agensgraph.adapters.assert_oids(conn: Connection[Any])#
Check the graph types’ oids against a server.
Bulk loading and memory#
See Bulk loading.
- class agensgraph.bulk.UpsertCounts(inserted: int, updated: int)#
What an upsert wrote.
- inserted: int#
- updated: int#
- agensgraph.paused_collection() Generator[None]#
A block during which Python’s cycle collector does not run.
- agensgraph.freeze_after_import()#
Move every object alive now out of the collector’s way. Once, at startup.
DB-API#
See Other tools.
- agensgraph.dbapi.connect(dsn: str = '', **kwargs: object) Connection[object]#
agensgraph.connect(), under PEP 249’s name. The module also hasapilevel,threadsafety,paramstyle, the type constructors and the exception classes.