Thank you Michael! That did the trick. --Pedro.
On Friday, 24 January 2014 17:56:25 UTC, Michael Bayer wrote: > > > > On Jan 24, 2014, at 5:24 AM, Pedro Romano <[email protected] <javascript:>> > wrote: > > > Which means the PostgreSQL enumerate type isn't being created as it would > have been if the postgresql.ENUM had been used directly in the column > definition instead of the decorated MyEnum. > > Is this behaviour by design or should the decorated column type be > expected to also create the corresponding PostgreSQL enumerate type? > > Thanks in advance for any feedback regarding this. > > > please use this approach in the case of a type like ENUM which requires > special schema-level steps: > > class MyEnum(sa.types.TypeDecorator, sa.types.SchemaType): > impl = postgresql.ENUM > > def _set_parent(self, column): > self.impl._set_parent(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) > Base.metadata.create_all(engine) > > > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.
