Open sqlalchemy-bot opened 8 years ago
Michael Bayer (zzzeek) wrote:
well SQLAlchemy would have to reflect this which I don't believe it does right now. SQLA can accept a pull request to include reflection of this option. sqlite_autoincrement is a rarely used option so the workaround here is not that unreasonable.
Changes by berend (berend):
Changes by berend (berend):
Migrated issue, originally created by berend (berend)
Given a sqlite3 table with
__tableargs__ = {'sqlite_autoincrement': True}
and abatch_op
migration touching that table:Model. initial migration
simple migration, making firstname nullable:
With echo-sql on I can see, that the first version of the
person
table hasautoincrement
on theid
column. During the second migration, alembic creates a temp table, because sqlite does not support alter column operations. That temp table does not have theautoincrement
on theid
column. After renaming it toperson
, the autoincrement is goneManually adding table kwargs to the batch_op is a workaround.
Do I have to always use table_kwargs to let alembic know? Or is there a bug when reading the table to create the temp table?