dstandish commented on PR #23056:
URL: https://github.com/apache/airflow/pull/23056#issuecomment-1102675192

   > From what I understand, `server_default` is injected into `ALTER TABLE` 
when the table is being modified (or `CREATE TABLE`), and without adding this 
to a migration this would do nothing.
   
   So it does _something_ -- namely, it seems to make it so that when it 
generates an insert, it doesn't include `map_index` as a column when it's not 
set.  I learned of the behavior 
[here](https://stackoverflow.com/questions/6536600/sqlalchemy-omit-attribute-in-insert-column-list/).
  And I did test it locally.  I don't think adding to migration would change 
the behavior (since NULL is already the server default, right?) but it's easy 
enough to do so I'll add that in a sec.
   
   > Instead of `server_default` perhaps we need to add `self.map_index = None` 
in `__init__` instead.
   
   I just tried this and it doesn't work.  I suspect it already gets a None 
value since it doesn't get set in init.
   
   You can test locally on main by taking a fresh db, dropping map_index from 
log table, and running `db upgrade`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to