timelink.migrations package
- timelink.migrations.column_exists(table_name, column_name, alembic_op)[source]
Check if a column exists
- Parameters:
table_name – name of table
column_name – name of column
alembic_op – alembic operations object in use
Example:
- timelink.migrations.current(db_url, verbose=False)[source]
Get the current revision of the database.
- timelink.migrations.downgrade(db_url, revision)[source]
Downgrade the database to the given revision.
- timelink.migrations.get_versions(base='base', head='heads')[source]
Get the list of versions of the database.
- Parameters:
base (str) – The base revision to start from.
head (str) – The head revision to stop at.
- timelink.migrations.set_db_url(db_url)[source]
Set the database URL in the alembic configuration.
This should be done before running any alembic commands in a specific database
- timelink.migrations.stamp(db_url, revision: str)[source]
Stamp current revision to a given revision Use “heads” to mark the database as up-to-date
- timelink.migrations.upgrade(db_url, revision='heads')[source]
Upgrade the database to a given revision (default most recent).
Submodules
timelink.migrations.alembic_extensions module
- class timelink.migrations.alembic_extensions.ReplaceableObject(name, sqltext)[source]
A class for creating replaceable database objects.
“We first need to create a simple object that represents the “CREATE View” / “DROP View” aspect of what it is we’re building. We can just as well put strings inside dictionaries, which would also work. Nevertheless, I will illustrate how this object helps organize the code below.”