summaryrefslogtreecommitdiff
path: root/alembic
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2023-02-06 23:30:58 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2023-02-07 08:58:33 -0500
commite6c67ae42284a711eaae64aabe14c722d9eeed54 (patch)
treeb0b5a0e486b46832cdcabdad859541dcd423cad6 /alembic
parent08266a49db1ce69224e62fa89f34f03a2f0f9529 (diff)
downloadalembic-e6c67ae42284a711eaae64aabe14c722d9eeed54.tar.gz
add variant render step for user-defined types
due to SQLA 2.0's variant being integrated into types, the variant rendering conditional would no longer take effect as the type was not under the "sqlalchemy" module namespace. Fixed issue where rendering of user-defined types that then went onto use the ``.with_variant()`` method would fail to render, if using SQLAlchemy 2.0's version of variants. Change-Id: I3c6f14325d6dffb2ddc1bf955753ee5a2de2cedd Fixes: #1167
Diffstat (limited to 'alembic')
-rw-r--r--alembic/autogenerate/render.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/alembic/autogenerate/render.py b/alembic/autogenerate/render.py
index 41903d8..4a144db 100644
--- a/alembic/autogenerate/render.py
+++ b/alembic/autogenerate/render.py
@@ -827,9 +827,9 @@ def _repr_type(
return "%s.%r" % (dname, type_)
elif impl_rt:
return impl_rt
+ elif not _skip_variants and sqla_compat._type_has_variants(type_):
+ return _render_Variant_type(type_, autogen_context)
elif mod.startswith("sqlalchemy."):
- if not _skip_variants and sqla_compat._type_has_variants(type_):
- return _render_Variant_type(type_, autogen_context)
if "_render_%s_type" % type_.__visit_name__ in globals():
fn = globals()["_render_%s_type" % type_.__visit_name__]
return fn(type_, autogen_context)