oslo_db.sqlalchemy.migration_cli package

oslo_db.sqlalchemy.migration_cli package

Submodules

oslo_db.sqlalchemy.migration_cli.ext_alembic module

class oslo_db.sqlalchemy.migration_cli.ext_alembic.AlembicExtension(engine, migration_config)

Bases: MigrationExtensionBase

Extension to provide alembic features.

Parameters:
  • engine (sqlalchemy.engine.Engine) – SQLAlchemy engine instance for a given database

  • migration_config (dict) – Stores specific configuration for migrations

downgrade(version)

Used for downgrading database.

Parameters:

version (string) – Desired database version

property enabled

Used for availability verification of a plugin.

Return type:

bool

has_revision(rev_id)

Checks whether the repo contains a revision

Parameters:

rev_id – Revision to check

Returns:

Whether the revision is in the repo

Return type:

bool

order = 2
revision(message='', autogenerate=False)

Creates template for migration.

Parameters:
  • message (string) – Text that will be used for migration title

  • autogenerate (bool) – If True - generates diff based on current database state

stamp(revision)

Stamps database with provided revision.

Parameters:

revision (string) – Should match one from repository or head - to stamp database with most recent revision

upgrade(version)

Used for upgrading database.

Parameters:

version (string) – Desired database version

version()

Current database version.

Returns:

Databse version

Return type:

string

oslo_db.sqlalchemy.migration_cli.ext_base module

class oslo_db.sqlalchemy.migration_cli.ext_base.MigrationExtensionBase

Bases: object

abstract downgrade(version)

Used for downgrading database.

Parameters:

version (string) – Desired database version

property enabled

Used for availability verification of a plugin.

Return type:

bool

has_revision(rev_id)

Checks whether the repo contains a revision

Parameters:

rev_id – Revision to check

Returns:

Whether the revision is in the repo

Return type:

bool

order = 0
revision(*args, **kwargs)

Used to generate migration script.

In migration engines that support this feature, it should generate new migration script.

Accept arbitrary set of arguments.

stamp(*args, **kwargs)

Stamps database based on plugin features.

Accept arbitrary set of arguments.

abstract upgrade(version)

Used for upgrading database.

Parameters:

version (string) – Desired database version

abstract version()

Current database version.

Returns:

Databse version

Return type:

string

oslo_db.sqlalchemy.migration_cli.ext_migrate module

class oslo_db.sqlalchemy.migration_cli.ext_migrate.MigrateExtension(engine, migration_config)

Bases: MigrationExtensionBase

Extension to provide sqlalchemy-migrate features.

Parameters:

migration_config (dict) – Stores specific configuration for migrations

downgrade(version)

Used for downgrading database.

Parameters:

version (string) – Desired database version

property enabled

Used for availability verification of a plugin.

Return type:

bool

has_revision(rev_id)

Checks whether the repo contains a revision

Parameters:

rev_id – Revision to check

Returns:

Whether the revision is in the repo

Return type:

bool

order = 1
upgrade(version)

Used for upgrading database.

Parameters:

version (string) – Desired database version

version()

Current database version.

Returns:

Databse version

Return type:

string

oslo_db.sqlalchemy.migration_cli.manager module

class oslo_db.sqlalchemy.migration_cli.manager.MigrationManager(migration_config, engine=None)

Bases: object

downgrade(revision)

Downgrade database with available backends.

revision(message, autogenerate)

Generate template or autogenerated revision.

stamp(revision)

Create stamp for a given revision.

upgrade(revision)

Upgrade database with all available backends.

version()

Return last version of db.

oslo_db.sqlalchemy.migration_cli.manager.check_plugin_enabled(ext)

Used for EnabledExtensionManager.

Module contents

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.