This seems to work / provide a good template of how to get that 
info: https://github.com/dw/alembic-autogenerate-enums

On Monday, September 24, 2018 at 5:19:39 PM UTC-4, Alex Rothberg wrote:
>
> and is there an easy way to progrmatically get the name of the enum from 
> the model field (given I declared it as as above)?
>
> On Monday, September 24, 2018 at 5:16:44 PM UTC-4, Mike Bayer wrote:
>>
>> you don't gain much since it only works on Postgresql anyway.    Also, 
>> the syntax you suggested wouldn't work, because Postgresql needs to 
>> know the name of the enumeration. 
>>
>> This is part of why all the "enum" issues for alembic are just open. 
>>   The way PG does it vs. MySQL are immensely different, and then none 
>> of the other databases have an ENUM type.    Your request for an 
>> "op.alter_column()" directive is basically asking for those issues to 
>> be done.   I'm on a long term search for code contributors who can 
>> work on that stuff, ENUM is going to be very hard to work front to 
>> back in all cases. 
>>
>>
>>
>>
>>
>>
>> On Mon, Sep 24, 2018 at 2:49 PM Alex Rothberg <agrot...@gmail.com> 
>> wrote: 
>> > 
>> > is there no way to get this alter statement without writing raw sql? 
>> > e.g. something like: op.alter_column("my_table", "my_column", 
>> existing_type=ENUM(...), type_=ENUM()) ? 
>> > 
>> > On Monday, September 24, 2018 at 2:36:52 PM UTC-4, Mike Bayer wrote: 
>> >> 
>> >> Postgresql ENUMs are entirely different from any other database so it 
>> >> matters a lot.  For PG, you'd want to be doing op.execute("ALTER TYPE 
>> >> myenum ..."), full syntax is at 
>> >> https://www.postgresql.org/docs/9.1/static/sql-altertype.html 
>> >> On Mon, Sep 24, 2018 at 12:45 PM Alex Rothberg <agrot...@gmail.com> 
>> wrote: 
>> >> > 
>> >> > Assuming that I am using the PEP-435 enum feature in SQLA, e.g.: 
>> >> > class InvitationReason(str, enum.Enum): 
>> >> >     ORIGINAL_ADMIN = "ORIGINAL_ADMIN" 
>> >> >     FIRM_USER = "FIRM_USER" 
>> >> >     ... 
>> >> > 
>> >> > reason = db.Column(db.Enum(InvitationReason), nullable=False) 
>> >> > 
>> >> > and I want to add / change the values in the enum. I know that 
>> alembic won't auto generate the migration. Given that, what is the simplest 
>> way to specify the migration by hand? I am using postgres, if that matters. 
>> >> > 
>> >> > -- 
>> >> > You received this message because you are subscribed to the Google 
>> Groups "sqlalchemy-alembic" group. 
>> >> > To unsubscribe from this group and stop receiving emails from it, 
>> send an email to sqlalchemy-alembic+unsubscr...@googlegroups.com. 
>> >> > For more options, visit https://groups.google.com/d/optout. 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> Groups "sqlalchemy-alembic" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an email to sqlalchemy-alembic+unsubscr...@googlegroups.com. 
>> > For more options, visit https://groups.google.com/d/optout. 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy-alembic+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to