Database Utilities (ixmp4.db.utils)
Submodules
ixmp4.db.utils.alembic module
- ixmp4.db.utils.alembic.downgrade_database(dsn: str, revision: str) None
Uses alembic to downgrade the given database.
- ixmp4.db.utils.alembic.get_database_revision(dsn: str) str | None
Returns the current revision hash of a given database. To do this a connection to the database and a call to alembic are required.
- ixmp4.db.utils.alembic.get_head_revision() str | tuple[str, ...] | None
Returns the revision hash of the newest migration in the alembic versions/ directory.
ixmp4.db.utils.sqlite module
- ixmp4.db.utils.sqlite.get_database_dir() Path
Returns the path to the local sqlite database directory.
- ixmp4.db.utils.sqlite.get_database_path(name: str) Path
Returns a
Path
object for a given sqlite database name. Does not check whether or not the file actually exists.
Module contents
- ixmp4.db.utils.collect_columns_to_select(columns: ColumnCollection[str, ColumnElement[Any]], exclude: Iterable[str]) ColumnCollection[str, ColumnElement[Any]]
- ixmp4.db.utils.create_id_map_subquery(old_exc: Subquery, new_exc: Subquery) Subquery
- ixmp4.db.utils.get_columns(model_class: type[BaseModel]) ReadOnlyColumnCollection[str, ColumnElement[Any]]
- ixmp4.db.utils.get_foreign_columns(model_class: type[BaseModel]) ReadOnlyColumnCollection[str, ColumnElement[int]]
- ixmp4.db.utils.get_pk_columns(model_class: type[BaseModel]) ReadOnlyColumnCollection[str, ColumnElement[int]]