Database Utilities (ixmp4.db.utils)
Submodules
ixmp4.db.utils.alembic module
- 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_path(name: str) Path
Returns a
Path
object for a given sqlite database name. Does not check whether or not the file actually exists.
- ixmp4.db.utils.sqlite.get_dsn(database_path: Path) str
Returns sqlalchemy-friendly sqlite database URI for a given database name.
Module contents
- ixmp4.db.utils.get_foreign_columns(model_class: type) ReadOnlyColumnCollection[str, ColumnElement[int]]