Issue #2919 new

schematype support for typedecorator / PG ENUM

Mike Bayer
repo owner created an issue

figure out how users would know to follow this pattern, or how this can be transparent:

import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.dialects import postgresql

Base = declarative_base()

class MyEnum(sa.types.TypeDecorator, sa.types.SchemaType):
    impl = postgresql.ENUM

    def _set_parent(self, column):

class Test(Base):
    __tablename__ = 'test'

    id = sa.Column(sa.Integer, primary_key=True)
    enum_column = sa.Column(MyEnum('1', '2', '3', name='my_enum_type'))

engine = sa.create_engine('postgresql://scott:tiger@localhost/test', echo=True)

Comments (1)

  1. Log in to comment