sqlalchemy - Alembic default value to be used in add_column -


how alembic use specified default value new column, without making server_default?

only existing rows should receive default value. new rows inserted after should still server_default.

i had similar problem, wanted new column not nullable, not work existing rows, of course. created row without not null constraint first, filled column custom python code , altered column (in same migration) have constraint.

so you'd iterate on existing objects, set values according transient default.


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -