1. Michael Bayer
  2. sqlalchemy
  3. Issues


Issue #2892 resolved

with_variant does not work for SchemaType

Michael Bayer
repo owner created an issue
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.dialects import postgresql

Base = declarative_base()

class A(Base):
    __tablename__ = 'a'
    id = Column(Integer, primary_key=True)
    things = Column(
            "one", "two", "three"
            postgresql.ENUM("one", "two", "three", name="my_enum"),

e = create_engine("postgresql://scott:tiger@localhost/test", echo=True)


tries to create the main "enum", does not do the right thing for the variant version either

Comments (7)

  1. Michael Bayer reporter

    Allow SchemaType and Variant to work together

    Added support for the :class:.Variant and the :class:.SchemaType objects to be compatible with each other. That is, a variant can be created against a type like :class:.Enum, and the instructions to create constraints and/or database-specific type objects will propagate correctly as per the variant's dialect mapping.

    Also added testing for some potential double-event scenarios on TypeDecorator but it seems usually this doesn't occur.

    Change-Id: I4a7e7c26b4133cd14e870f5bc34a1b2f0f19a14a Fixes: #2892

    → <<cset c04870ba7b80>>

  2. Log in to comment