- changed title to add PG's "create_type" argument to the base Enum type; also look into "create_constraint" for SchemaType in general
with_variant does not work for SchemaType
Issue #2892
resolved
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(
Enum(
"one", "two", "three"
).with_variant(
postgresql.ENUM("one", "two", "three", name="my_enum"),
"postgresql"
)
)
e = create_engine("postgresql://scott:tiger@localhost/test", echo=True)
Base.metadata.drop_all(e)
Base.metadata.create_all(e)
tries to create the main "enum", does not do the right thing for the variant version either
Comments (7)
-
reporter -
reporter - changed milestone to 0.9.xx
-
reporter - changed milestone to 1.0.xx
-
reporter -
reporter - changed milestone to 1.x.xx
-
reporter - changed title to with_variant does not work for SchemaType
- changed milestone to 1.1.x
- marked as bug
- edited description
-
reporter - changed status to resolved
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>>
- Log in to comment