Class tigrbl.session.abc.SessionABC
tigrbl.session.abc.SessionABC
Bases: ABC
Authoritative Tigrbl session interface.
All concrete sessions MUST be natively transactional and implement the methods below. This ABC is intentionally minimal and backend-agnostic.
begin
abstractmethod
async
begin()
Open a native transaction for this session.
Source code in tigrbl/session/abc.py
16 17 18 |
|
commit
abstractmethod
async
commit()
Commit the current transaction.
Source code in tigrbl/session/abc.py
20 21 22 |
|
rollback
abstractmethod
async
rollback()
Rollback the current transaction.
Source code in tigrbl/session/abc.py
24 25 26 |
|
in_transaction
abstractmethod
in_transaction()
Return True iff a transaction is currently open.
Source code in tigrbl/session/abc.py
28 29 30 |
|
get
abstractmethod
async
get(model, ident)
Fetch one instance by primary key (model, ident).
Source code in tigrbl/session/abc.py
33 34 35 |
|
add
abstractmethod
add(obj)
Stage a new/dirty object for persistence.
Source code in tigrbl/session/abc.py
37 38 39 |
|
delete
abstractmethod
async
delete(obj)
Stage an object for deletion.
Source code in tigrbl/session/abc.py
41 42 43 |
|
flush
abstractmethod
async
flush()
Flush staged changes to the underlying store (still in TX).
Source code in tigrbl/session/abc.py
45 46 47 |
|
refresh
abstractmethod
async
refresh(obj)
Refresh the object from the store (respecting the current TX view).
Source code in tigrbl/session/abc.py
49 50 51 |
|
execute
abstractmethod
async
execute(stmt)
Execute a backend-native statement.
The result (if any) SHOULD provide a minimal facade compatible with: - .scalars().all() - .scalar_one() to ease integration with higher-level helpers.
Source code in tigrbl/session/abc.py
53 54 55 56 57 58 59 60 61 62 |
|
close
abstractmethod
async
close()
Release underlying resources (connections, cursors, etc.).
Source code in tigrbl/session/abc.py
65 66 67 |
|
run_sync
abstractmethod
async
run_sync(fn)
Execute a callback against the underlying native handle.
Presence of this method also acts as the "async session" marker for code paths that need to distinguish sync-vs-async sessions.
Source code in tigrbl/session/abc.py
69 70 71 72 73 74 75 76 |
|