rel_1_18_0
📦 alembicView on GitHub →
✨ 3 features🐛 2 fixes🔧 10 symbols
Summary
This release introduces a plugin system for extensions and configurable autogenerate compare functionality. It also enhances autogenerate reflection with bulk inspector methods and improves directory organization for migration files.
Migration Steps
- When using directory paths in `file_template`, ensure `recursive_version_locations` is set to `true`.
- To avoid deprecation warnings in SQLAlchemy 2.1+, explicitly set `isolate_from_table=True` when running with SQLAlchemy 2.1 or greater for add/drop constraint operations.
✨ New Features
- When alembic is run in "verbose" mode, alembic now logs a message to indicate from which file is used to load the configuration.
- Autogenerate reflection sweeps now use the "bulk" inspector methods introduced in SQLAlchemy 2.0, which for selected dialects including PostgreSQL and Oracle use batched queries to reflect whole collections of tables using O(1) queries rather than O(N).
- Introduced a plugin system that allows for automatic loading of third-party extensions as well as configurable autogenerate compare functionality on a per-environment basis. The `Plugin` class provides a common interface for extensions. A new interface for registering autogenerate comparison handlers, `Plugin.add_autogenerate_comparator()`, provides for autogenerate compare functionality that may be custom-configured on a per-environment basis using the new `EnvironmentContext.configure.autogenerate_plugins` parameter. Alembic's autogenerate compare functionality is reorganized into a series of internal plugins under the `alembic.autogenerate` namespace, which may be individually or collectively identified for inclusion and/or exclusion within the `EnvironmentContext.configure()` call using a new parameter `EnvironmentContext.configure.autogenerate_plugins`.
🐛 Bug Fixes
- Fixed issue where PostgreSQL sequence defaults on non-primary key columns were incorrectly detected as changed on every autogenerate run. Server default comparison logic is adjusted to filter out the `::regclass` expression added by the server which interferes with the comparison.
- Implemented DDL for column comment add/update/delete when using the `Operations.alter_column.comment` parameter with `Operations.alter_column()` on Microsoft SQL Server. Previously, these functions were not implemented for SQL Server and would raise `UnsupportedCompilationError`.
Affected Symbols
alembic.autogeneratealembic.plugins.toplevelOperations.register_operation()Operations.implementation_for()Plugin.add_autogenerate_comparator()EnvironmentContext.configure.autogenerate_pluginsEnvironmentContext.configure()Operations.alter_column.commentOperations.alter_column()UnsupportedCompilationError