ephraimbuddy opened a new pull request, #23444:
URL: https://github.com/apache/airflow/pull/23444

   Bulk delete does not work if the cascade behaviour of a foreignkey
   is set on python side(relationship configuration). To allow bulk delete of 
dags
   we need to setup cascade deletion in the DB.
   
   The warning on query.delete at
   
https://docs.sqlalchemy.org/en/14/orm/session_basics.html#selecting-a-synchronization-strategy
   stated that:
   
   The operations do not offer in-Python cascading of relationships - it is 
assumed that ON UPDATE CASCADE and/or ON DELETE CASCADE is configured for any 
foreign key references which require it, otherwise the database may emit an 
integrity violation if foreign key references are being enforced.
   
   Another alternative is avoiding bulk delete of dags but I prefer we support 
bulk deletes.
   
   This will break offline sql generation for mssql(already broken before now 
:) ). Also, since there's only one foreign key
   in `dag_tag` table, I assume that the foreign key would be named 
`dag_tag_ibfk_1` in `mysql`. This
   avoided having to query the db for the name.
   
   The foreignkey is explicitly named now, would be easy for future upgrades
   
   Closes: #23414, Closes: #23206
   
   


-- 
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