alembic API reference
104 public APIs from alembic (sqlalchemy/alembic) — 35 classes, 30 functions, 39 methods. Signatures extracted by static analysis of the actual source.
Repository: sqlalchemy/alembic
| Kind | Count |
|---|---|
| Classes | 35 |
| Functions | 30 |
| Methods | 39 |
API list
method
alembic.autogenerate.rewriter.Rewriter.chain(other:ProcessRevisionDirectiveFn | Rewriter) -> RewriterProduce a "chain" of this :class:`.Rewriter` to another.
func
alembic.command.branches(config:Config, verbose:bool=False) -> NoneShow current branch points.
func
alembic.command.check(config:Config) -> NoneCheck if revision command with autogenerate has pending upgrade ops.
func
alembic.command.current(config:Config, check_heads:bool=False, verbose:bool=False) -> NoneDisplay the current revision for a database.
func
alembic.command.downgrade(config:Config, revision:str, sql:bool=False, tag:str | None=None) -> NoneRevert to a previous version.
func
alembic.command.edit(config:Config, rev:str) -> NoneEdit revision script(s) using $EDITOR.
func
alembic.command.ensure_version(config:Config, sql:bool=False) -> NoneCreate the alembic version table if it doesn't exist already .
func
alembic.command.heads(config:Config, verbose:bool=False, resolve_dependencies:bool=False) -> NoneShow current available heads in the script directory.
func
alembic.command.history(config:Config, rev_range:str | None=None, verbose:bool=False, indicate_current:bool=False) -> NoneList changeset scripts in chronological order.
func
alembic.command.init(config:Config, directory:str, template:str='generic', package:bool=False) -> NoneInitialize a new scripts directory.
func
alembic.command.list_templates(config:Config) -> NoneList available templates.
func
alembic.command.merge(config:Config, revisions:_RevIdType, message:str | None=None, branch_label:_RevIdType | None=None, rev_id:str | None=None, splice:bool=False) -> Script | NoneMerge two revisions together.
func
alembic.command.show(config:Config, rev:str) -> NoneShow the revision(s) denoted by the given symbol.
func
alembic.command.upgrade(config:Config, revision:str, sql:bool=False, tag:str | None=None) -> NoneUpgrade to a later version.
class
alembic.config.CommandLineProvides the command line interface to Alembic.
method
alembic.config.CommandLine.main(argv:Sequence[str] | None=None) -> NoneExecutes the command line with the provided arguments.
method
alembic.config.CommandLine.register_command(fn:CommandFunction) -> NoneRegisters a function as a CLI subcommand.
class
alembic.config.ConfigRepresent an Alembic configuration.
method
alembic.config.Config.attributes() -> dict[str, Any]A Python dictionary for storage of additional state.
method
alembic.config.Config.file_config() -> ConfigParserReturn the underlying ``ConfigParser`` object.
method
alembic.config.Config.get_section_option(section:str, name:str, default:str | None=None) -> str | NoneReturn an option from the given section of the .ini file.
method
alembic.config.Config.messaging_opts() -> MessagingOptionsThe messaging options.
method
alembic.config.Config.print_stdout(text:str, *arg:Any) -> NoneRender a message to standard out.
method
alembic.config.Config.set_main_option(name:str, value:str) -> NoneSet an option programmatically within the 'main' section.
method
alembic.config.Config.set_section_option(section:str, name:str, value:str) -> NoneSet an option programmatically within the given section.
func
alembic.config.main(argv:Sequence[str] | None=None, prog:str | None=None, **kwargs:Any) -> NoneThe console runner function for Alembic.
class
alembic.ddl.base.AlterTableRepresent an ALTER TABLE statement.
func
alembic.ddl.base.quote_dotted(name:quoted_name | str, quote:functools.partial) -> quoted_name | strquote the elements of a dotted name
class
alembic.ddl.postgresql.CreateExcludeConstraintOpRepresent a create exclude constraint operation.
class
alembic.operations.base.AbstractOperationsBase class for Operations and BatchOperations.
method
alembic.operations.base.AbstractOperations.get_bind() -> ConnectionReturn the current 'bind'.
method
alembic.operations.base.AbstractOperations.register_operation(name:str, sourcename:str | None=None) -> Callable[[type[_T]], type[_T]]Register a new operation for this class.
class
alembic.operations.base.BatchOperationsModifies the interface :class:`.Operations` for batch mode.
class
alembic.operations.base.OperationsDefine high level migration operations.
method
alembic.operations.base.Operations.rename_table(old_table_name:str, new_table_name:str, *schema:str | None=None) -> NoneEmit an ALTER TABLE to rename a table.
class
alembic.operations.ops.AddColumnOpRepresent an add column operation.
class
alembic.operations.ops.AddConstraintOpRepresent an add constraint operation.
class
alembic.operations.ops.AlterColumnOpRepresent an alter column operation.
class
alembic.operations.ops.AlterTableOpRepresent an alter table operation.
class
alembic.operations.ops.BulkInsertOpRepresent a bulk insert operation.
class
alembic.operations.ops.CreateCheckConstraintOpRepresent a create check constraint operation.
class
alembic.operations.ops.CreateForeignKeyOpRepresent a create foreign key constraint operation.
class
alembic.operations.ops.CreateIndexOpRepresent a create index operation.
class
alembic.operations.ops.CreatePrimaryKeyOpRepresent a create primary key operation.
class
alembic.operations.ops.CreateTableCommentOpRepresent a COMMENT ON `table` operation.
class
alembic.operations.ops.CreateTableOpRepresent a create table operation.
class
alembic.operations.ops.CreateUniqueConstraintOpRepresent a create unique constraint operation.
class
alembic.operations.ops.DropColumnOpRepresent a drop column operation.
class
alembic.operations.ops.DropConstraintOpRepresent a drop constraint operation.
class
alembic.operations.ops.DropIndexOpRepresent a drop index operation.
class
alembic.operations.ops.DropTableCommentOpRepresent an operation to remove the comment from a table.
class
alembic.operations.ops.DropTableOpRepresent a drop table operation.
class
alembic.operations.ops.ExecuteSQLOpRepresent an execute SQL operation.
class
alembic.operations.ops.MigrateOperationbase class for migration command and organization objects.
class
alembic.operations.ops.MigrationScriptrepresents a migration script.
method
alembic.operations.ops.MigrationScript.downgrade_ops() -> DowngradeOps | NoneAn instance of :class:`.DowngradeOps`.
method
alembic.operations.ops.MigrationScript.downgrade_ops_list() -> list[DowngradeOps]A list of :class:`.DowngradeOps` instances.
method
alembic.operations.ops.MigrationScript.upgrade_ops() -> UpgradeOps | NoneAn instance of :class:`.UpgradeOps`.
method
alembic.operations.ops.MigrationScript.upgrade_ops_list() -> list[UpgradeOps]A list of :class:`.UpgradeOps` instances.
class
alembic.operations.ops.OpContainerRepresent a sequence of operations operation.
class
alembic.operations.ops.RenameTableOpRepresent a rename table operation.
method
alembic.operations.ops.RenameTableOp.rename_table(operations:Operations, old_table_name:str, new_table_name:str, *schema:str | None=None) -> NoneEmit an ALTER TABLE to rename a table.
method
alembic.runtime.environment.EnvironmentContext.get_bind() -> ConnectionReturn the current 'bind'.
method
alembic.runtime.environment.EnvironmentContext.get_context() -> MigrationContextReturn the current :class:`.MigrationContext` object.
method
alembic.runtime.environment.EnvironmentContext.get_revision_argument() -> _RevNumberGet the 'destination' revision argument.
method
alembic.runtime.environment.EnvironmentContext.static_output(text:str) -> NoneEmit text directly to the "offline" SQL stream.
method
alembic.runtime.plugins.Plugin.remove() -> Noneremove this plugin
class
alembic.script.base.ScriptRepresent a single revision file in a ``versions/`` directory.
method
alembic.script.base.Script.doc() -> strReturn the docstring given in the script.
method
alembic.script.base.Script.longdoc() -> strReturn the docstring given in the script.
class
alembic.script.base.ScriptDirectoryProvides operations upon an Alembic script directory.
method
alembic.script.base.ScriptDirectory.as_revision_number(id_:str | None) -> str | tuple[str, ...] | NoneConvert a symbolic revision, i.e.
method
alembic.script.base.ScriptDirectory.get_base() -> str | NoneReturn the "base" revision as a string.
method
alembic.script.base.ScriptDirectory.get_bases() -> list[str]return all "base" revisions as strings.
method
alembic.script.base.ScriptDirectory.get_current_head() -> str | NoneReturn the current head revision.
method
alembic.script.base.ScriptDirectory.get_heads(consider_depends_on:bool=False) -> list[str]Return all "versioned head" revisions as strings.
method
alembic.script.base.ScriptDirectory.get_revision(id_:str) -> ScriptReturn the :class:`.Script` instance with the given rev id.
method
alembic.script.base.ScriptDirectory.run_env() -> NoneRun the script environment.
method
alembic.script.base.ScriptDirectory.walk_revisions(base:str='base', head:str='heads') -> Iterator[Script]Iterate through all revisions.
class
alembic.script.revision.RevisionBase class for revisioned objects.
method
alembic.script.revision.Revision.is_merge_point() -> boolReturn True if this :class:`.Script` is a merge point.
class
alembic.script.revision.RevisionMapMaintains a map of :class:`.Revision` objects.
method
alembic.script.revision.RevisionMap.add_revision(revision:Revision, _replace:bool=False) -> Noneadd a single revision to an existing map.
method
alembic.script.revision.RevisionMap.bases() -> tuple[str, ...]All "base" revisions as strings.
method
alembic.script.revision.RevisionMap.get_current_head(branch_label:str | None=None) -> str | NoneReturn the current head revision.
method
alembic.script.revision.RevisionMap.get_revision(id_:str | None) -> Revision | NoneReturn the :class:`.Revision` instance with the given rev id.
method
alembic.script.revision.RevisionMap.heads() -> tuple[str, ...]All "head" revisions as strings.
func
alembic.templates.async.env.run_migrations_offline() -> NoneRun migrations in 'offline' mode.
func
alembic.templates.async.env.run_migrations_online() -> NoneRun migrations in 'online' mode.
func
alembic.templates.generic.env.run_migrations_offline() -> NoneRun migrations in 'offline' mode.
func
alembic.templates.generic.env.run_migrations_online() -> NoneRun migrations in 'online' mode.
func
alembic.templates.multidb.env.run_migrations_offline() -> NoneRun migrations in 'offline' mode.
func
alembic.templates.multidb.env.run_migrations_online() -> NoneRun migrations in 'online' mode.
func
alembic.templates.pyproject.env.run_migrations_offline() -> NoneRun migrations in 'offline' mode.
func
alembic.templates.pyproject.env.run_migrations_online() -> NoneRun migrations in 'online' mode.
func
alembic.templates.pyproject_async.env.run_migrations_offline() -> NoneRun migrations in 'offline' mode.
func
alembic.templates.pyproject_async.env.run_migrations_online() -> NoneRun migrations in 'online' mode.
func
alembic.util.compat.formatannotation_fwdref(annotation:Any, base_module:Any | None=None) -> strvendored from python 3.7
func
alembic.util.compat.importlib_metadata_get(group:str) -> Sequence[EntryPoint]provide a facade for metadata.entry_points().
func
alembic.util.editor.open_in_editor(filename:str, environ:dict[str, str] | None=None) -> NoneOpens the given file in a text editor.
class
alembic.util.exc.CommandErrorBase command error for all exceptions
class
alembic.util.exc.DatabaseNotAtHeadIndicates the database is not at current head revisions.
func
alembic.util.pyfiles.load_python_file(dir_:str | os.PathLike[str], filename:str | os.PathLike[str]) -> ModuleTypeLoad a file from the given path as a Python module.
func
alembic.util.pyfiles.pyc_file_from_path(path:str | os.PathLike[str]) -> pathlib.Path | NoneGiven a python source path, locate the .pyc.
About this data
These signatures were extracted from the public source of sqlalchemy/alembic
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.