Re: [sqlalchemy] Reuse pre-defined Enum?

2014-07-03 Thread Mike Bayer
this works fine for me: def upgrade(): mytype = ENUM('a', 'b', 'c', create_type=False, name='myenum') mytype.create(op.get_bind(), checkfirst=False) op.create_table('t1', sa.Column('id', sa.Integer(), nullable=False), sa.Column('col1', mytype) ) op.create_ta

Re: [sqlalchemy] Reuse pre-defined Enum?

2014-07-03 Thread Anton
Hey guys, I am facing the same issue, I am using PostgreSQL and want to use native ENUM type in two tables. For migration I am going to use alembic. Did you guys find out any was to do this? Thanks, Anton On Thursday, May 1, 2014 10:33:21 AM UTC-7, Michael Bayer wrote: > > OK. ENUM is somethi

Re: [sqlalchemy] Reuse pre-defined Enum?

2014-05-01 Thread Michael Bayer
OK. ENUM is something I'd have to dedicate several days of attention on :( On May 1, 2014, at 1:32 PM, Vlad Wing wrote: > Yes, that's exactly what happend. I specified "create_type=False" and it was > ignored. Alembic tried to create the type anyway and, of course, it failed. > > -- > You r

Re: [sqlalchemy] Reuse pre-defined Enum?

2014-05-01 Thread Vlad Wing
Yes, that's exactly what happend. I specified "create_type=False" and it was ignored. Alembic tried to create the type anyway and, of course, it failed. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop rece

Re: [sqlalchemy] Reuse pre-defined Enum?

2014-05-01 Thread Michael Bayer
On May 1, 2014, at 1:09 PM, Vlad Wing wrote: > use the PG ENUM type instead and add create_type=False: > > from sqlalchemy.dialects.postgresql import ENUM > > ENUM('male', 'female', name='gt', create_type=False) > > This method didn't work for me. The safest way I could find is to manually

Re: [sqlalchemy] Reuse pre-defined Enum?

2014-05-01 Thread Vlad Wing
> > use the PG ENUM type instead and add create_type=False: > > from sqlalchemy.dialects.postgresql import ENUM > > ENUM(‘male’, ‘female’, name=‘gt’, create_type=False) > This method didn't work for me. The safest way I could find is to manually edit the autogenerated script, removing the ref

Re: [sqlalchemy] Reuse pre-defined Enum?

2014-04-10 Thread Michael Bayer
On Apr 10, 2014, at 1:12 PM, Nguyễn Hồng Quân wrote: > > Before, I had gender_type declared inline in model A (gender = > Column(Enum('male', 'female', name='gender_type'))). > Now I add model B and also want to reuse the gender_type in model A. So, I > bring gender_type out and link to it f

Re: [sqlalchemy] Reuse pre-defined Enum?

2014-04-10 Thread Nguyễn Hồng Quân
Hi Michael, On Mon, Dec 16, 2013 at 12:37 AM, Michael Bayer wrote: > > On Dec 15, 2013, at 4:16 AM, Hồng Quân Nguyễn > wrote: > > Hi all, > > Assume that I have this model > > class ModelA: > gender = Column(Enum('male', 'female', name='gender_type')) > > and in another ModelB, I want to

Re: [sqlalchemy] Reuse pre-defined Enum?

2013-12-15 Thread Michael Bayer
On Dec 15, 2013, at 4:16 AM, Hồng Quân Nguyễn wrote: > Hi all, > > Assume that I have this model > > class ModelA: > gender = Column(Enum('male', 'female', name='gender_type')) > > and in another ModelB, I want to reuse this gender_type Enum, how should I > reuse, because if I write >

[sqlalchemy] Reuse pre-defined Enum?

2013-12-15 Thread Hồng Quân Nguyễn
Hi all, Assume that I have this model class ModelA: gender = Column(Enum('male', 'female', name='gender_type')) and in another ModelB, I want to reuse this gender_type Enum, how should I reuse, because if I write class ModelB: gender = Column(Enum('male', 'female', name='gender_type