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

Jay Pipes jaypipes at gmail.com
Fri Jan 23 18:41:28 UTC 2015


On 01/23/2015 08:40 AM, Mike Bayer wrote:
> 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.

++ Agreed. I see no reason at all to run migrations against SQLite 
databases.

-jay



More information about the OpenStack-dev mailing list