From 67cc8a9befa25a24d9589f363dfffbb223507867 Mon Sep 17 00:00:00 2001 From: DanCardin Date: Mon, 7 Oct 2024 15:35:41 -0400 Subject: [PATCH] fix: Undo accidental inclusion of alembic as required dependencies. --- CHANGELOG.md | 20 +++++++++----- pyproject.toml | 2 +- .../alembic/base.py | 27 +++++++------------ 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d00dd6e..30805fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,14 +2,22 @@ ## 0.15 +### 0.15.4 + +- fix: Undo accidental inclusion of alembic as required dependencies. + +### 0.15.3 + +- fix: Handle row/view metadata sequence. + ### 0.15.2 -fix: Handle trigger metadata sequence. -fix: Handle procedure metadata sequence. -fix: Handle function metadata sequence. -fix: Handle grant metadata sequence. -fix: Handle role metadata sequence. -fix: Handle schema metadata sequence. +- fix: Handle trigger metadata sequence. +- fix: Handle procedure metadata sequence. +- fix: Handle function metadata sequence. +- fix: Handle grant metadata sequence. +- fix: Handle role metadata sequence. +- fix: Handle schema metadata sequence. ### 0.15.1 diff --git a/pyproject.toml b/pyproject.toml index a81e96d..446e069 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "sqlalchemy-declarative-extensions" -version = "0.15.3" +version = "0.15.4" authors = ["Dan Cardin "] description = "Library to declare additional kinds of objects not natively supported by SQLAlchemy/Alembic." diff --git a/src/sqlalchemy_declarative_extensions/alembic/base.py b/src/sqlalchemy_declarative_extensions/alembic/base.py index 948f2bb..50469b8 100644 --- a/src/sqlalchemy_declarative_extensions/alembic/base.py +++ b/src/sqlalchemy_declarative_extensions/alembic/base.py @@ -1,17 +1,5 @@ from __future__ import annotations -import typing - -from alembic.autogenerate.compare import comparators -from alembic.autogenerate.render import renderers -from alembic.autogenerate.rewriter import Rewriter -from alembic.operations import Operations - -if typing.TYPE_CHECKING: - from alembic.operations.ops import MigrateOperation - from alembic.runtime.migration import MigrationContext - from alembic.script.revision import _GetRevArg - def register_alembic_events( *, @@ -60,33 +48,36 @@ def register_alembic_events( import sqlalchemy_declarative_extensions.alembic.row # noqa -def _traverse_any_directive( - self, - context: MigrationContext, - revision: _GetRevArg, - directive: MigrateOperation, -) -> None: +def _traverse_any_directive(self, context, revision, directive) -> None: pass def register_comparator_dispatcher(fn, target: str): + from alembic.autogenerate.compare import comparators + dispatcher = comparators.dispatch_for(target) dispatcher(fn) def register_renderer_dispatcher(*ops, fn): + from alembic.autogenerate.render import renderers + for op in ops: dispatcher = renderers.dispatch_for(op) dispatcher(fn) def register_rewriter_dispatcher(*ops): + from alembic.autogenerate.rewriter import Rewriter + for op in ops: dispatcher = Rewriter._traverse.dispatch_for(op) dispatcher(_traverse_any_directive) def register_operation_dispatcher(*, fn, **ops): + from alembic.operations import Operations + for operation_name, op in ops.items(): operation_dispatcher = Operations.register_operation(operation_name) operation_dispatcher(op)