alter table with sequence

354 views
Skip to first unread message

Ofir Herzas

unread,
Sep 21, 2015, 10:18:47 AM9/21/15
to sqlalchemy-alembic
rename_table operation does not rename sequences if they exist.
This causes a problem that the renamed table is unusable since the sequence is missing.

In Oracle, a simple rename works well (RENAME old_seq_name TO new_seq_name;) although it says "table renamed".

Is there a sequence rename operation in Alembic? (not "drop" and "create")



Mike Bayer

unread,
Sep 21, 2015, 11:11:25 AM9/21/15
to sqlalchem...@googlegroups.com
built-in operations for sequences are a TODO for now, you can emit the ALTER statement directly using op.execute():

op.execute("ALTER SEQUENCE foo RENAME TO bar")





--
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-alem...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ofir Herzas

unread,
Sep 21, 2015, 1:31:36 PM9/21/15
to sqlalchem...@googlegroups.com

Thanks Mike. I already did use execute.
I was hoping for a more generic solution, but it'll do for now...

You received this message because you are subscribed to a topic in the Google Groups "sqlalchemy-alembic" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sqlalchemy-alembic/MYyM1j-cWm4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sqlalchemy-alem...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages