[openstack-dev] [all] Use of new batch_alter_table method of Alembic

Mike Bayer mbayer at redhat.com
Fri Jan 23 16:40:14 UTC 2015



Andrew Pashkin <apashkin at mirantis.com> wrote:

> Hi all!
> 
> Recently In Murano project, we encountered a problem with drop column operation in Alembic migration using SQLite. And now we think, what is the best way to resolve this problem.
> 
> Alembic developers implemented a special tool as workaround for such cases:
> https://bitbucket.org/zzzeek/alembic/issue/21/column-renames-not-supported-on-sqlite
> http://alembic.readthedocs.org/en/latest/batch.html
> 
> Note, that they say, that this feature is in "Beta" mode currently.
> 
> So there are two options:
> 1) Use Alembic beta feature - batch_alter_table. This implies rewriting of all migrations with drop column and other operations.
> 2) Just recommend users to not use SQLite in cases where unsupported ALTER TABLE operations needed.

I think openstack’s use case for SQLite migrations is strictly one of how the tests are organized, and I’ve said from the beginning that running migrations on SQLite just for tests is pointless.    Migration tests IMO should only be on target DBs  using the “opportunistic” system, which currently provides bases like MySQLOpportunisticTestBase and PostgresqlOpportunisticTestBase.

That said, people told me Alembic is a non-starter without SQLite support so the batch feature was added.  


More information about the OpenStack-dev mailing list