[openstack-dev] [savanna] Alembic migrations and absence of DROP column in sqlite

Trevor McKay tmckay at redhat.com
Thu Jan 30 19:51:52 UTC 2014

I was playing with alembic migration and discovered that
op.drop_column() doesn't work with sqlite.  This is because sqlite
doesn't support dropping a column (broken imho, but that's another
discussion).  Sqlite throws a syntax error.

To make this work with sqlite, you have to copy the table to a temporary
excluding the column(s) you don't want and delete the old one, followed
by a rename of the new table.

The existing 002 migration uses op.drop_column(), so I'm assuming it's
broken, too (I need to check what the migration test is doing).  I was
working on an 003.

How do we want to handle this?  Three good options I can think of:

1) don't support migrations for sqlite (I think "no", but maybe)

2) Extend alembic so that op.drop_column() does the right thing (more
open-source contributions for us, yay :) )

3) Add our own wrapper in savanna so that we have a drop_column() method
that wraps copy/rename.

Ideas, comments?



More information about the OpenStack-dev mailing list