deb-alembic/docs/build/api/config.rst

1.2 KiB

Configuration

Note

this section discusses the internal API of Alembic as regards internal configuration constructs. This section is only useful for developers who wish to extend the capabilities of Alembic. For documentation on configuration of an Alembic environment, please see /tutorial.

The .Config object represents the configuration passed to the Alembic environment. From an API usage perspective, it is needed for the following use cases:

  • to create a .ScriptDirectory, which allows you to work with the actual script files in a migration environment
  • to create an .EnvironmentContext, which allows you to actually run the env.py module within the migration environment
  • to programatically run any of the commands in the alembic.command.toplevel module.

The .Config is not needed for these cases:

  • to instantiate a .MigrationContext directly - this object only needs a SQLAlchemy connection or dialect name.
  • to instantiate a .Operations object - this object only needs a .MigrationContext.

alembic.config