I am new to
alembic so maybe I missunderstand something.
I know that sqlite3 doesn't offer a
ALTER TABLE and that is why there is the batch-Operation in alembic. Nice.
I tried the auto-migration described in the tutorial. In that situation alembic doesn't detected that a sqlite3 database is used. That info could be simply found in the
alembic revision --autogenerate work without errors and generate that (snipped) code:
from alembic import op def upgrade(): op.drop_column('TrainingUnit', 'foobar')
alembic upgrade head causes an error (in my opinion) because sqlite doesn't support
The snipped error messages:
File "/usr/local/lib/python3.4/dist-packages/alembic/operations/toimpl.py", line 81, in drop_column **operation.kw File "/usr/local/lib/python3.4/dist-packages/alembic/ddl/impl.py", line 178, in drop_column self._exec(base.DropColumn(table_name, column, schema=schema)) File "/usr/local/lib/python3.4/dist-packages/alembic/ddl/impl.py", line 121, in _exec return conn.execute(construct, *multiparams, **params) File "/usr/local/lib/python3.4/dist-packages/sqlalchemy/engine/base.py", line 914, in execute return meth(self, multiparams, params) .. File "/usr/local/lib/python3.4/dist-packages/sqlalchemy/engine/default.py", line 450, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) near "DROP": syntax error [SQL: 'ALTER TABLE "TrainingUnit" DROP COLUMN foobar']
Is my observation correct that alembic doesn't deteced the use of an sqlite-database and that is why it doesn't generate code with the batch-Operation?
If so: This is a feauter request to implement it.