sdkagent

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

KindCount
Classes35
Functions30
Methods39

API list

methodalembic.autogenerate.rewriter.Rewriter.chain(other:ProcessRevisionDirectiveFn | Rewriter) -> Rewriter
Produce a "chain" of this :class:`.Rewriter` to another.
funcalembic.command.branches(config:Config, verbose:bool=False) -> None
Show current branch points.
funcalembic.command.check(config:Config) -> None
Check if revision command with autogenerate has pending upgrade ops.
funcalembic.command.current(config:Config, check_heads:bool=False, verbose:bool=False) -> None
Display the current revision for a database.
funcalembic.command.downgrade(config:Config, revision:str, sql:bool=False, tag:str | None=None) -> None
Revert to a previous version.
funcalembic.command.edit(config:Config, rev:str) -> None
Edit revision script(s) using $EDITOR.
funcalembic.command.ensure_version(config:Config, sql:bool=False) -> None
Create the alembic version table if it doesn't exist already .
funcalembic.command.heads(config:Config, verbose:bool=False, resolve_dependencies:bool=False) -> None
Show current available heads in the script directory.
funcalembic.command.history(config:Config, rev_range:str | None=None, verbose:bool=False, indicate_current:bool=False) -> None
List changeset scripts in chronological order.
funcalembic.command.init(config:Config, directory:str, template:str='generic', package:bool=False) -> None
Initialize a new scripts directory.
funcalembic.command.list_templates(config:Config) -> None
List available templates.
funcalembic.command.merge(config:Config, revisions:_RevIdType, message:str | None=None, branch_label:_RevIdType | None=None, rev_id:str | None=None, splice:bool=False) -> Script | None
Merge two revisions together.
funcalembic.command.show(config:Config, rev:str) -> None
Show the revision(s) denoted by the given symbol.
funcalembic.command.upgrade(config:Config, revision:str, sql:bool=False, tag:str | None=None) -> None
Upgrade to a later version.
classalembic.config.CommandLine
Provides the command line interface to Alembic.
methodalembic.config.CommandLine.main(argv:Sequence[str] | None=None) -> None
Executes the command line with the provided arguments.
methodalembic.config.CommandLine.register_command(fn:CommandFunction) -> None
Registers a function as a CLI subcommand.
classalembic.config.Config
Represent an Alembic configuration.
methodalembic.config.Config.attributes() -> dict[str, Any]
A Python dictionary for storage of additional state.
methodalembic.config.Config.file_config() -> ConfigParser
Return the underlying ``ConfigParser`` object.
methodalembic.config.Config.get_section_option(section:str, name:str, default:str | None=None) -> str | None
Return an option from the given section of the .ini file.
methodalembic.config.Config.messaging_opts() -> MessagingOptions
The messaging options.
methodalembic.config.Config.print_stdout(text:str, *arg:Any) -> None
Render a message to standard out.
methodalembic.config.Config.set_main_option(name:str, value:str) -> None
Set an option programmatically within the 'main' section.
methodalembic.config.Config.set_section_option(section:str, name:str, value:str) -> None
Set an option programmatically within the given section.
funcalembic.config.main(argv:Sequence[str] | None=None, prog:str | None=None, **kwargs:Any) -> None
The console runner function for Alembic.
classalembic.ddl.base.AlterTable
Represent an ALTER TABLE statement.
funcalembic.ddl.base.quote_dotted(name:quoted_name | str, quote:functools.partial) -> quoted_name | str
quote the elements of a dotted name
classalembic.ddl.postgresql.CreateExcludeConstraintOp
Represent a create exclude constraint operation.
classalembic.operations.base.AbstractOperations
Base class for Operations and BatchOperations.
methodalembic.operations.base.AbstractOperations.get_bind() -> Connection
Return the current 'bind'.
methodalembic.operations.base.AbstractOperations.register_operation(name:str, sourcename:str | None=None) -> Callable[[type[_T]], type[_T]]
Register a new operation for this class.
classalembic.operations.base.BatchOperations
Modifies the interface :class:`.Operations` for batch mode.
classalembic.operations.base.Operations
Define high level migration operations.
methodalembic.operations.base.Operations.rename_table(old_table_name:str, new_table_name:str, *schema:str | None=None) -> None
Emit an ALTER TABLE to rename a table.
classalembic.operations.ops.AddColumnOp
Represent an add column operation.
classalembic.operations.ops.AddConstraintOp
Represent an add constraint operation.
classalembic.operations.ops.AlterColumnOp
Represent an alter column operation.
classalembic.operations.ops.AlterTableOp
Represent an alter table operation.
classalembic.operations.ops.BulkInsertOp
Represent a bulk insert operation.
classalembic.operations.ops.CreateCheckConstraintOp
Represent a create check constraint operation.
classalembic.operations.ops.CreateForeignKeyOp
Represent a create foreign key constraint operation.
classalembic.operations.ops.CreateIndexOp
Represent a create index operation.
classalembic.operations.ops.CreatePrimaryKeyOp
Represent a create primary key operation.
classalembic.operations.ops.CreateTableCommentOp
Represent a COMMENT ON `table` operation.
classalembic.operations.ops.CreateTableOp
Represent a create table operation.
classalembic.operations.ops.CreateUniqueConstraintOp
Represent a create unique constraint operation.
classalembic.operations.ops.DropColumnOp
Represent a drop column operation.
classalembic.operations.ops.DropConstraintOp
Represent a drop constraint operation.
classalembic.operations.ops.DropIndexOp
Represent a drop index operation.
classalembic.operations.ops.DropTableCommentOp
Represent an operation to remove the comment from a table.
classalembic.operations.ops.DropTableOp
Represent a drop table operation.
classalembic.operations.ops.ExecuteSQLOp
Represent an execute SQL operation.
classalembic.operations.ops.MigrateOperation
base class for migration command and organization objects.
classalembic.operations.ops.MigrationScript
represents a migration script.
methodalembic.operations.ops.MigrationScript.downgrade_ops() -> DowngradeOps | None
An instance of :class:`.DowngradeOps`.
methodalembic.operations.ops.MigrationScript.downgrade_ops_list() -> list[DowngradeOps]
A list of :class:`.DowngradeOps` instances.
methodalembic.operations.ops.MigrationScript.upgrade_ops() -> UpgradeOps | None
An instance of :class:`.UpgradeOps`.
methodalembic.operations.ops.MigrationScript.upgrade_ops_list() -> list[UpgradeOps]
A list of :class:`.UpgradeOps` instances.
classalembic.operations.ops.OpContainer
Represent a sequence of operations operation.
classalembic.operations.ops.RenameTableOp
Represent a rename table operation.
methodalembic.operations.ops.RenameTableOp.rename_table(operations:Operations, old_table_name:str, new_table_name:str, *schema:str | None=None) -> None
Emit an ALTER TABLE to rename a table.
methodalembic.runtime.environment.EnvironmentContext.get_bind() -> Connection
Return the current 'bind'.
methodalembic.runtime.environment.EnvironmentContext.get_context() -> MigrationContext
Return the current :class:`.MigrationContext` object.
methodalembic.runtime.environment.EnvironmentContext.get_revision_argument() -> _RevNumber
Get the 'destination' revision argument.
methodalembic.runtime.environment.EnvironmentContext.static_output(text:str) -> None
Emit text directly to the "offline" SQL stream.
methodalembic.runtime.plugins.Plugin.remove() -> None
remove this plugin
classalembic.script.base.Script
Represent a single revision file in a ``versions/`` directory.
methodalembic.script.base.Script.doc() -> str
Return the docstring given in the script.
methodalembic.script.base.Script.longdoc() -> str
Return the docstring given in the script.
classalembic.script.base.ScriptDirectory
Provides operations upon an Alembic script directory.
methodalembic.script.base.ScriptDirectory.as_revision_number(id_:str | None) -> str | tuple[str, ...] | None
Convert a symbolic revision, i.e.
methodalembic.script.base.ScriptDirectory.get_base() -> str | None
Return the "base" revision as a string.
methodalembic.script.base.ScriptDirectory.get_bases() -> list[str]
return all "base" revisions as strings.
methodalembic.script.base.ScriptDirectory.get_current_head() -> str | None
Return the current head revision.
methodalembic.script.base.ScriptDirectory.get_heads(consider_depends_on:bool=False) -> list[str]
Return all "versioned head" revisions as strings.
methodalembic.script.base.ScriptDirectory.get_revision(id_:str) -> Script
Return the :class:`.Script` instance with the given rev id.
methodalembic.script.base.ScriptDirectory.run_env() -> None
Run the script environment.
methodalembic.script.base.ScriptDirectory.walk_revisions(base:str='base', head:str='heads') -> Iterator[Script]
Iterate through all revisions.
classalembic.script.revision.Revision
Base class for revisioned objects.
methodalembic.script.revision.Revision.is_merge_point() -> bool
Return True if this :class:`.Script` is a merge point.
classalembic.script.revision.RevisionMap
Maintains a map of :class:`.Revision` objects.
methodalembic.script.revision.RevisionMap.add_revision(revision:Revision, _replace:bool=False) -> None
add a single revision to an existing map.
methodalembic.script.revision.RevisionMap.bases() -> tuple[str, ...]
All "base" revisions as strings.
methodalembic.script.revision.RevisionMap.get_current_head(branch_label:str | None=None) -> str | None
Return the current head revision.
methodalembic.script.revision.RevisionMap.get_revision(id_:str | None) -> Revision | None
Return the :class:`.Revision` instance with the given rev id.
methodalembic.script.revision.RevisionMap.heads() -> tuple[str, ...]
All "head" revisions as strings.
funcalembic.templates.async.env.run_migrations_offline() -> None
Run migrations in 'offline' mode.
funcalembic.templates.async.env.run_migrations_online() -> None
Run migrations in 'online' mode.
funcalembic.templates.generic.env.run_migrations_offline() -> None
Run migrations in 'offline' mode.
funcalembic.templates.generic.env.run_migrations_online() -> None
Run migrations in 'online' mode.
funcalembic.templates.multidb.env.run_migrations_offline() -> None
Run migrations in 'offline' mode.
funcalembic.templates.multidb.env.run_migrations_online() -> None
Run migrations in 'online' mode.
funcalembic.templates.pyproject.env.run_migrations_offline() -> None
Run migrations in 'offline' mode.
funcalembic.templates.pyproject.env.run_migrations_online() -> None
Run migrations in 'online' mode.
funcalembic.templates.pyproject_async.env.run_migrations_offline() -> None
Run migrations in 'offline' mode.
funcalembic.templates.pyproject_async.env.run_migrations_online() -> None
Run migrations in 'online' mode.
funcalembic.util.compat.formatannotation_fwdref(annotation:Any, base_module:Any | None=None) -> str
vendored from python 3.7
funcalembic.util.compat.importlib_metadata_get(group:str) -> Sequence[EntryPoint]
provide a facade for metadata.entry_points().
funcalembic.util.editor.open_in_editor(filename:str, environ:dict[str, str] | None=None) -> None
Opens the given file in a text editor.
classalembic.util.exc.CommandError
Base command error for all exceptions
classalembic.util.exc.DatabaseNotAtHead
Indicates the database is not at current head revisions.
funcalembic.util.pyfiles.load_python_file(dir_:str | os.PathLike[str], filename:str | os.PathLike[str]) -> ModuleType
Load a file from the given path as a Python module.
funcalembic.util.pyfiles.pyc_file_from_path(path:str | os.PathLike[str]) -> pathlib.Path | None
Given 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.

Back to all 805 libraries