Describe the bug
An autogenerated migration adding a column using a TypeDecorator type and a with_variant() override loses the variants when using SQLAlchemy 2.0.
Expected behavior
The autogenerated migration includes the variants.
To Reproduce
With the following model definition and then alembic revision --autogenerate.
from sqlalchemy import Column, String, types
from sqlalchemy.dialects import postgresql
from sqlalchemy.orm import declarative_base
Base = declarative_base()
class UUID(types.TypeDecorator):
impl = String
class Test(Base):
__tablename__ = "test"
id = Column(UUID().with_variant(postgresql.UUID(), "postgresql"), primary_key=True)
Error
With SQLAlchemy 1.4.46 the following migration is generated:
op.create_table('test',
sa.Column('id', models.UUID().with_variant(postgresql.UUID(), 'postgresql'), nullable=False),
sa.PrimaryKeyConstraint('id')
)
Whereas with SQLALchemy 2.0.2 the with_variant() is missing:
op.create_table('test',
sa.Column('id', models.UUID(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
Versions.
- OS: Linux
- Python: 3.10
- Alembic: 1.9.2
- SQLAlchemy: 2.0.2
- Database: SQLite
- DBAPI: sqlite
Describe the bug
An autogenerated migration adding a column using a
TypeDecoratortype and awith_variant()override loses the variants when using SQLAlchemy 2.0.Expected behavior
The autogenerated migration includes the variants.
To Reproduce
With the following model definition and then
alembic revision --autogenerate.Error
With SQLAlchemy 1.4.46 the following migration is generated:
Whereas with SQLALchemy 2.0.2 the
with_variant()is missing:Versions.