Skip to main content
SQLAlchemy plugin path — event listeners for mutations + in-span reads. Install:: from alibi_sdk.plugins import create_sqlalchemy_plugin plugin = create_sqlalchemy_plugin(engine) alibi.init(project=“demo”, plugins=[plugin]) Listeners honor the active sandbox binding (schema / search_path pin). Commit awareness: while a real SQLAlchemy transaction is open, mutation/read events are buffered per connection. They flush into the Alibi span buffer on the outermost commit (the one that persists) and are discarded on rollback. Nested transactions / SAVEPOINTs do not flush: a nested rollback drops only events recorded after that SAVEPOINT; a nested release keeps them pending until the root commit. Outside a transaction (DBAPI autocommit isolation), events record immediately — the previous behavior. Source: python/alibi_sdk/alibi_sdk/plugins/sqlalchemy_plugin.py

SQLAlchemyPlugin

Bases: Plugin

__init__

Parameters Returns None

active_schema

Returns str

attach

Register SQLAlchemy event listeners on the engine. Parameters Returns None

snapshot

Parameters Returns SnapshotHandle

observe

Parameters Returns dict[str, Any]

restore

Parameters Returns None

create_sqlalchemy_plugin

Parameters Returns SQLAlchemyPlugin