-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Add fk between xcom and task instance #22334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
|
Forgot to mention, we can do this directly because the prior |
|
Eh, need to fix tests now though, we are currently doing a lot of dangling inserts. |
|
Alright hopefully this fixes everything. Mostly changing the test code, but I also needed to change how |
Also improved the dag_run relationship to use the dag_run_id field directly because why not?
Previously, 'airflow task test' creates a in-memory DAG run and task instance to run the task. However, with XCom establishing a database level foreign key, this violates integrity and causes issues when the task pushes to XCom. Therefore, we rewrite the command to create a "real" DAG run (and task instance) instead and delete it afterwards. Since both task instance and XCom tables declare the foreign key with ON DELETE CASCADE, this also cleans them up properly and leaves no trace in the database after the command is complete.
|
Some good to me |
As discussed previously.
Also improved the dag_run relationship to use the dag_run_id field directly because why not?