babylon.kernel.database

Kernel protocol for the injectable database connection.

babylon.persistence.database.DatabaseConnection is the SQLAlchemy implementation; this protocol is the surface the engine’s service container types against, so SQLAlchemy plumbing lives in the persistence layer and the engine holds only the contract (Constitution II.6 — “no DB I/O during tick”; Program 14 Phase 1 removed the concrete import from the engine’s DI).

Structural conformance is pinned by tests/unit/kernel/.

Classes

DatabaseProtocol(*args, **kwargs)

Injectable database connection surface.

class babylon.kernel.database.DatabaseProtocol(*args, **kwargs)[source]

Bases: Protocol

Injectable database connection surface.

session() yields a live session inside a context manager; close() disposes the underlying engine.

session()[source]

Open a session context; commit/rollback semantics are the impl’s.

Return type:

AbstractContextManager[Any]

close()[source]

Dispose of the connection’s resources.

Return type:

None

__init__(*args, **kwargs)