fmn.database.main module

class fmn.database.main.CustomBase[source]

Bases: object

async classmethod async_get(db_session: AsyncSession, **attrs) Base[source]

Get an object from the datbase.

Parameters:

db_session – The SQLAlchemy session to use

Returns:

the object

async classmethod async_get_or_create(db_session: AsyncSession, **attrs) Base[source]

Get an object from the database or create if missing.

Parameters:

db_session – The SQLAlchemy session to use

Returns:

the object

The returned object will have an (ephemeral) boolean attribute _was_created which allows finding out if it existed previously or not.

fmn.database.main.get_async_engine()[source]
fmn.database.main.get_sync_engine()[source]
async fmn.database.main.init_async_model(async_engine: AsyncEngine | None = None)[source]
fmn.database.main.init_sync_model(sync_engine: Engine | None = None)[source]