Skip to main content
`Ctrl`+`K`

# API Details

Alembic’s internal API has many public integration points that can be used to extend Alembic’s functionality as well as to reuse its functionality in new ways. As the project has grown, more APIs are created and exposed for this purpose.

Direct use of the vast majority of API details discussed here is not needed for rudimentary use of Alembic; the only API that is used normally by end users is the methods provided by the `Operations` class, which is discussed outside of this subsection, and the parameters that can be passed to the `EnvironmentContext.configure()` method, used when configuring one’s `env.py` environment. However, real-world applications will usually end up using more of the internal API, in particular being able to run commands programmatically, as discussed in the section Commands.

- Overview
- Runtime Objects
  - The Environment Context
  - The Migration Context
- Configuration
  - `CommandFunction`
  - `CommandLine`
  - `Config`
  - `MessagingOptions`
  - `main()`
- Commands
  - `branches()`
  - `check()`
  - `current()`
  - `downgrade()`
  - `edit()`
  - `ensure_version()`
  - `heads()`
  - `history()`
  - `init()`
  - `list_templates()`
  - `merge()`
  - `revision()`
  - `show()`
  - `stamp()`
  - `upgrade()`
- Operation Directives
  - Operation Plugins
  - Built-in Operation Objects
  - Extending Existing Operations
- Autogeneration
  - Getting Diffs
  - Customizing Revision Generation
  - Autogenerating Custom Operation Directives
- Script Directory
  - `Script`
  - `ScriptDirectory`
  - Revision
  - Write Hooks
- DDL Internals
  - `AddColumn`
  - `AlterColumn`
  - `AlterTable`
  - `ColumnComment`
  - `ColumnDefault`
  - `ColumnName`
  - `ColumnNullable`
  - `ColumnType`
  - `ComputedColumnDefault`
  - `DropColumn`
  - `IdentityColumnDefault`
  - `RenameTable`
  - `add_column()`
  - `alter_column()`
  - `alter_table()`
  - `drop_column()`
  - `format_column_name()`
  - `format_server_default()`
  - `format_table_name()`
  - `format_type()`
  - `quote_dotted()`
  - `visit_add_column()`
  - `visit_column_default()`
  - `visit_column_name()`
  - `visit_column_nullable()`
  - `visit_column_type()`
  - `visit_computed_column()`
  - `visit_drop_column()`
  - `visit_identity_column()`
  - `visit_rename_table()`
  - `DefaultImpl`
  - `ImplMeta`
  - `Params`
  - MySQL
  - MS-SQL
  - Postgresql
  - SQLite
- Plugins
  - Overview
  - Installing and Using Plugins
  - Enabling Autogenerate Plugins in env.py
  - Writing a Plugin
  - Plugin API Reference
- Exception Objects
  - `AutogenerateDiffsDetected`
  - `CommandError`
  - `DatabaseNotAtHead`