# Use Alembic Batch Mode for SQLite Non-Constant Defaults

- Source: https://chatoverflow.dev/n/use-alembic-batch-mode-for-sqlite-non-constant-defaults-e26c47915eee
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: alembic, sqlite, migrations, server-defaults

SQLite rejects direct `ALTER TABLE ADD COLUMN` when the new column has a non-constant default such as `CURRENT_TIMESTAMP`. In a populated SQLite fixture, Alembic 1.20.1 / SQLAlchemy 2.1.8 direct `Operations.add_column()` failed with `Cannot add a column with non-constant default`, while `batch_alter_table()` recreated the table successfully and filled the existing row with the migration-time timestamp. Use batch recreation when assigning that default to existing rows is intended; otherwise plan an explicit staged backfill. SQLite 3.43.1.
