Alembic
Backend & InfraA database migrations tool for SQLAlchemy.
Release History
rel_1_18_4Breaking1 fixThis patch reverts the automatic inline rendering of PRIMARY KEY constraints in `Operations.add_column()` introduced in 1.18.2, making this behavior explicitly opt-in via the new `inline_primary_key` parameter.
rel_1_18_32 fixesThis patch fixes a critical regression in autogenerate related to foreign key referencing unreflected tables and updates the minimum required SQLAlchemy version for the 1.4 series to 1.4.23.
rel_1_18_21 fix2 featuresThis release enhances `Operations.add_column()` by honoring the `primary_key` parameter and introducing the `inline_references` option for foreign key rendering. A typing bug affecting server default parameters in `AlterColumnOp` was also resolved.
rel_1_18_12 fixesThis patch release addresses a logging issue in the new plugin system and revises handling of SQLAlchemy 2.1 deprecation warnings related to isolate_from_table=True.
rel_1_18_0rel_1_17_21 fix1 featureVersion 1.17.2 introduces a replace parameter for operation implementations and fixes a SQL Server dialect bug related to default constraint handling.
rel_1_17_1Breaking1 fix1 featureVersion 1.17.1 introduces a new `--check-heads` option for `alembic current` and tightens revision ID validation by rejecting ':' characters, requiring migration of any existing colon‑containing IDs.
rel_1_17_0BreakingVersion 1.17.0 raises the minimum Python requirement to 3.10 and switches the internal test runner to nox, with tox support slated for removal.
rel_1_16_52 fixesRelease 1.16.5 resolves two bugs: correct MySQL index expression rendering and proper parsing of `truncate_slug_length` in pyproject.toml configuration.
rel_1_16_41 fixThis release resolves a bug in pyproject.toml handling that prevented boolean values for certain configuration options from being recognized.
rel_1_16_32 fixes2 featuresRelease 1.16.3 introduces the `pyproject_async` template and a new module post‑write hook for autogenerate, and fixes rendering issues with server defaults and foreign key constraints.
rel_1_16_22 fixesVersion 1.16.2 addresses two bugs: it restores proper rendering of dialect-specific keyword arguments for foreign key operations and corrects newline handling when updating `pyproject.toml`.
rel_1_16_12 fixesVersion 1.16.1 addresses two regressions introduced by a pathlib refactor, restoring proper template directory handling and fixing missing template error messages.
rel_1_16_0Breaking4 fixes6 featuresAlembic 1.16.0 adds PEP 621 configuration, a new CLI registration API, enhanced path handling, and several operation flags, while fixing autogenerate and deprecation issues.
rel_1_15_21 fixBug fix for autogenerate handling of AlterColumnOp.modified_name.
rel_1_15_11 fixRelease 1.15.1 resolves an installation bug where Alembic's template files were omitted from the wheel distribution due to a PEP 621 pyproject.toml issue.
rel_1_15_0Breaking2 fixes2 featuresAlembic 1.15.0 drops support for Python 3.8 and SQLAlchemy 1.3, adds label rendering for index autogeneration and revision context to diff detection, and includes several lint‑friendly and rendering bug fixes.
rel_1_14_12 fixes1 featureVersion 1.14.1 introduces SQLite column rename support, adds tzdata to tz extras, and resolves autogenerate Variant type rendering bugs.
Common Errors
UnsupportedCompilationError1 reportUnsupportedCompilationError in Alembic often arises when the database dialect lacks support for a specific DDL operation used in your migration (like altering column comments in MSSQL). Address this by either using a different, supported approach (e.g., custom SQL execution with `op.execute()`) or, if possible, updating to a newer Alembic version that provides better dialect support for the specific operation. Review the database's documentation and alembic's dialect implementation before choosing an alternative.
NotImplementedError1 reportThe "NotImplementedError" in Alembic often arises when a specific database operation, like `drop_constraint` with `if_exists`, isn't fully supported by the underlying database or SQLAlchemy version you are using. To fix it, conditionally execute the operation only when supported, typically by checking the database dialect or SQLAlchemy version, and provide an alternative implementation (or skip the operation) when not supported. Alternatively, upgrade SQLAlchemy to a version where the feature is implemented, ensuring compatibility with your database.
NameError1 reportThis NameError in Alembic usually arises when a required class or function, such as `FetchedValue`, is used without being properly imported from the SQLAlchemy or Alembic libraries. To resolve this, add an explicit import statement at the top of your migration script, such as `from sqlalchemy.orm import FetchedValue` or `from sqlalchemy import FetchedValue`, depending on the specific location of the missing class in the SQLAlchemy/Alembic library. Ensure the import statement aligns with the documentation for the Alembic/SQLAlchemy version being used.
Related Backend & Infra Packages
Production-Grade Container Scheduling and Management
Node.js JavaScript runtime ✨🐢🚀✨
Promise based HTTP client for the browser and node.js
A modern runtime for JavaScript and TypeScript.
Deliver web apps with confidence 🚀
Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
Subscribe to Updates
Get notified when new versions are released