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.