Data Module
fluvius.data is the SQL persistence layer. It provides SQLAlchemy-backed drivers and schemas, data-access managers, typed models, query translation, serialization, identifiers, ETags, and transaction helpers.
Connector and manager
from fluvius.data import DataAccessManager, DomainSchema, SqlaDriver
class AppConnector(SqlaDriver):
__db_dsn__ = "postgresql+asyncpg://user:password@localhost/app"
class AppSchema(AppConnector.__data_schema_base__, DomainSchema):
__abstract__ = True
__table_args__ = {"schema": "app"}
class AppDataManager(DataAccessManager):
__connector__ = AppConnector
__automodel__ = True
Applications normally declare concrete schema models beneath the connector's generated base and register them with the manager.
CRUD and queries
from fluvius.data import BackendQuery, UUID_GENR
manager = AppDataManager()
async with manager.transaction():
record = manager.create("author", {
"_id": str(UUID_GENR()),
"name": "Ada",
"email": "ada@example.com",
})
await manager.insert(record)
item = await manager.fetch("author", record._id)
items = await manager.query("author", BackendQuery(limit=100))
Use ReadonlyDataManagerProxy when a consumer must not mutate data. BackendQuery.create(where=..., limit=..., offset=...) accepts operators such as field:eq; query resources provide the HTTP-facing validation layer.
Supported backends
The shipped driver is SQLAlchemy. PostgreSQL is the production target and SQLite is used by focused tests. MongoDB and in-memory drivers mentioned by older docs are not part of the current codebase.