Q:

Why doesnt a default value affect the table in sqlalchemy?

Im trying to update my tables and add new column, to this column should be a default Integer value, I tried to use default and also default_server as recommend here: Why isn't sqlalchemy's default column value working
 but the value of this field stay null, It is possible to set Integer default value?
col = Column(field_name, data_type, default=0)
column_name = column.compile(dialect=engine.dialect)
column_type = column.type.compile(engine.dialect)
engine.execute('ALTER TABLE %s ADD COLUMN %s %s' % (table_name, column_name, column_type))

A:

The problem is that your manual ALTER TABLE statement does not add the default and leaves the column nullable; having server_default on the Column object has no effect. If you want a default, add it:
engine.execute('ALTER TABLE %s ADD COLUMN %s %s DEFAULT 0' % (table_name, column_name, column_type))

I'd highly recommend using alembic for database migrations. 

