database
alembic_commands
prefect.server.database.alembic_commands
Functions
with_alembic_lock
Decorator that prevents alembic commands from running concurrently. This is necessary because alembic uses a global configuration object that is not thread-safe.
This issue occurred in https://github.com/PrefectHQ/prefect-dask/pull/50, where
dask threads were simultaneously performing alembic upgrades, and causing
cryptic KeyError: 'config'
when del globals_[attr_name]
.
alembic_config
alembic_upgrade
Run alembic upgrades on Prefect REST API database
Args:
revision
: The revision passed toalembic downgrade
. Defaults to ‘head’, upgrading all revisions.dry_run
: Show what migrations would be made without applying them. Will emit sql statements to stdout.
alembic_downgrade
Run alembic downgrades on Prefect REST API database
Args:
revision
: The revision passed toalembic downgrade
. Defaults to ‘base’, downgrading all revisions.dry_run
: Show what migrations would be made without applying them. Will emit sql statements to stdout.
alembic_revision
Create a new revision file for the database.
Args:
message
: string message to apply to the revision.autogenerate
: whether or not to autogenerate the script from the database.
alembic_stamp
Stamp the revision table with the given revision; don’t run any migrations
Args:
revision
: The revision passed toalembic stamp
.