server.web.db
Submodules
Attributes
Functions
|
Yield a SQLAlchemy Session managed inside a context-manager. |
|
Return the lazily-initialised SQLAlchemy engine. |
|
Lower-case dialect string, e.g. 'mysql', 'sqlite', 'postgresql'. |
|
Get the SQLAlchemy sessionmaker singleton. |
|
Check if the current database dialect is MySQL. |
|
Check if the current database dialect is SQLite. |
|
Apply Alembic migrations to the database. |
|
Initialize the database: create if needed, apply migrations. |
|
Drop the database if it exists. |
Package Contents
- server.web.db.get_db() Generator[sqlalchemy.orm.Session, None, None][source]
Yield a SQLAlchemy Session managed inside a context-manager.
- server.web.db.get_engine() sqlalchemy.engine.Engine[source]
Return the lazily-initialised SQLAlchemy engine.
- server.web.db.get_dialect_name() str[source]
Lower-case dialect string, e.g. ‘mysql’, ‘sqlite’, ‘postgresql’.
- server.web.db.get_sessionmaker() sqlalchemy.orm.sessionmaker[source]
Get the SQLAlchemy sessionmaker singleton.
- server.web.db.apply_migrations(uri: str, revision: str = 'head') None[source]
Apply Alembic migrations to the database.