Warning
This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.
galaxy.model.migrations package¶
- class galaxy.model.migrations.DatabaseConfig(url, template, encoding)[source]¶
Bases:
tuple
- property url¶
Alias for field number 0
- property template¶
Alias for field number 1
- property encoding¶
Alias for field number 2
- exception galaxy.model.migrations.IncorrectVersionError(model: str, expected_version: int)[source]¶
Bases:
Exception
- exception galaxy.model.migrations.OutdatedDatabaseError(model: str, db_version: str, code_version: str)[source]¶
Bases:
Exception
- class galaxy.model.migrations.AlembicManager(engine: Engine, config_dict: Optional[dict] = None)[source]¶
Bases:
object
Alembic operations on one database.
- static is_at_revision(engine: Engine, revision: Union[str, Iterable[str]]) bool [source]¶
True if revision is a subset of the set of version heads stored in the database.
- stamp_revision(revision: Union[str, Iterable[str]]) None [source]¶
Partial proxy to alembic’s stamp command.
- is_under_version_control(model: ModelId) bool [source]¶
True if the database version table contains a revision that corresponds to a revision in the script directory that has branch label model.
- class galaxy.model.migrations.DatabaseStateCache(engine: Engine)[source]¶
Bases:
object
Snapshot of database state.
- galaxy.model.migrations.metadata_contains_only_kombu_tables(metadata: MetaData) bool [source]¶
Return True if metadata contains only kombu-related tables. (ref: https://github.com/galaxyproject/galaxy/issues/13689)
- galaxy.model.migrations.verify_databases_via_script(gxy_config: DatabaseConfig, tsi_config: DatabaseConfig, is_auto_migrate: bool = False) None [source]¶
- galaxy.model.migrations.verify_databases(gxy_engine: Engine, gxy_template: Optional[str], gxy_encoding: Optional[str], tsi_engine: Optional[Engine], tsi_template: Optional[str], tsi_encoding: Optional[str], is_auto_migrate: bool) None [source]¶
- class galaxy.model.migrations.DatabaseStateVerifier(engine: Engine, model: ModelId, database_template: Optional[str], database_encoding: Optional[str], is_auto_migrate: bool, is_new_database: Optional[bool] = False)[source]¶
Bases:
object
- __init__(engine: Engine, model: ModelId, database_template: Optional[str], database_encoding: Optional[str], is_auto_migrate: bool, is_new_database: Optional[bool] = False) None [source]¶
- property db_state: DatabaseStateCache¶
- property alembic_manager: AlembicManager¶
- galaxy.model.migrations.get_alembic_manager(engine: Engine) AlembicManager [source]¶
Submodules¶
galaxy.model.migrations.scripts module¶
- exception galaxy.model.migrations.scripts.DatabaseDoesNotExistError(db_url: str)[source]¶
Bases:
Exception
- exception galaxy.model.migrations.scripts.DatabaseNotInitializedError(db_url: str)[source]¶
Bases:
Exception
- galaxy.model.migrations.scripts.verify_database_is_initialized(db_url: str) None [source]¶
Intended for use by scripts that run database migrations (manage_db.sh, run_alembic.sh). Those scripts are meant to run on a database that has been initialized with the appropriate metadata (e.g. galaxy or install model).
This function will raise an error if the database does not exist or has not been initialized*.
NOTE: this function cannot determine whether a database has been properly initialized; it can only tell when a database has *not been initialized.
- galaxy.model.migrations.scripts.get_configuration(argv: List[str], cwd: str) Tuple[DatabaseConfig, DatabaseConfig, bool] [source]¶
Return a 3-item-tuple with configuration values used for managing databases.
- galaxy.model.migrations.scripts.get_configuration_from_file(cwd: str, config_file: Optional[str] = None) Tuple[DatabaseConfig, DatabaseConfig, bool] [source]¶
- galaxy.model.migrations.scripts.add_db_urls_to_command_arguments(argv: List[str], gxy_url: str, tsi_url: str) None [source]¶
- galaxy.model.migrations.scripts.invoke_alembic() None [source]¶
Invoke the Alembic command line runner.
Accept ‘heads’ as the target revision argument to enable upgrading both gxy and tsi in one command. This is consistent with Alembic’s CLI, which allows upgrade heads. However, this would not work for separate gxy and tsi databases: we can’t attach a database url to a revision after Alembic has been invoked with the ‘upgrade’ command and the ‘heads’ argument. So, instead we invoke Alembic for each head.
- exception galaxy.model.migrations.scripts.LegacyScriptsException(message: str)[source]¶
Bases:
Exception
- class galaxy.model.migrations.scripts.LegacyManageDb[source]¶
Bases:
object
- LEGACY_CONFIG_FILE_ARG_NAMES = ['-c', '--config', '--config-file']¶
- get_gxy_version()[source]¶
Get the head revision for the gxy branch from the Alembic script directory. (previously referred to as “max/repository version”)
- get_gxy_db_version(gxy_db_url=None)[source]¶
Get the head revision for the gxy branch from the galaxy database. If there is no alembic_version table, get the sqlalchemy migrate version. Raise error if that version is not the latest. (previously referred to as “database version”)
- galaxy.model.migrations.scripts.get_alembic_manager(engine: Engine) AlembicManager [source]¶