tirkarthi commented on code in PR #31352:
URL: https://github.com/apache/airflow/pull/31352#discussion_r1197789230


##########
airflow/models/taskinstance.py:
##########
@@ -2821,15 +2821,16 @@ def tg2(inp):
 
     def clear_db_references(self, session):
         """
-        Clear DB references to XCom, TaskFail and RenderedTaskInstanceFields.
+        Clear DB references to XCom, TaskFail, TaskInstanceNote,
+        TaskReschedule and RenderedTaskInstanceFields.

Review Comment:
   Postgres gives the referenced by output
   
   ```
   airflow_user@127:airflow_db> \d task_instance;
   
+----------------------+-----------------------------+---------------------------------+
   | Column               | Type                        | Modifiers             
          |
   
|----------------------+-----------------------------+---------------------------------|
   | task_id              | character varying(250)      |  not null             
          |
   | dag_id               | character varying(250)      |  not null             
          |
   | run_id               | character varying(250)      |  not null             
          |
   | map_index            | integer                     |  not null default 
'-1'::integer |
   | start_date           | timestamp with time zone    |                       
          |
   | end_date             | timestamp with time zone    |                       
          |
   | duration             | double precision            |                       
          |
   | state                | character varying(20)       |                       
          |
   | try_number           | integer                     |                       
          |
   | max_tries            | integer                     |  default 
'-1'::integer          |
   | hostname             | character varying(1000)     |                       
          |
   | unixname             | character varying(1000)     |                       
          |
   | job_id               | integer                     |                       
          |
   | pool                 | character varying(256)      |  not null             
          |
   | pool_slots           | integer                     |  not null             
          |
   | queue                | character varying(256)      |                       
          |
   | priority_weight      | integer                     |                       
          |
   | operator             | character varying(1000)     |                       
          |
   | queued_dttm          | timestamp with time zone    |                       
          |
   | queued_by_job_id     | integer                     |                       
          |
   | pid                  | integer                     |                       
          |
   | executor_config      | bytea                       |                       
          |
   | updated_at           | timestamp with time zone    |                       
          |
   | external_executor_id | character varying(250)      |                       
          |
   | trigger_id           | integer                     |                       
          |
   | trigger_timeout      | timestamp without time zone |                       
          |
   | next_method          | character varying(1000)     |                       
          |
   | next_kwargs          | json                        |                       
          |
   
+----------------------+-----------------------------+---------------------------------+
   Indexes:
       "task_instance_pkey" PRIMARY KEY, btree (dag_id, task_id, run_id, 
map_index)
       "ti_dag_run" btree (dag_id, run_id)
       "ti_dag_state" btree (dag_id, state)
       "ti_job_id" btree (job_id)
       "ti_pool" btree (pool, state, priority_weight)
       "ti_state" btree (state)
       "ti_state_incl_start_date" btree (dag_id, task_id, state) INCLUDE 
(start_date)
       "ti_state_lkp" btree (dag_id, task_id, run_id, state)
       "ti_trigger_id" btree (trigger_id)
   Foreign-key constraints:
       "task_instance_dag_run_fkey" FOREIGN KEY (dag_id, run_id) REFERENCES 
dag_run(dag_id, run_id) ON DELETE CASCADE
       "task_instance_trigger_id_fkey" FOREIGN KEY (trigger_id) REFERENCES 
trigger(id) ON DELETE CASCADE
   Referenced by:
       TABLE "task_fail" CONSTRAINT "task_fail_ti_fkey" FOREIGN KEY (dag_id, 
task_id, run_id, map_index) REFERENCES task_instance(dag_id, task_id, run_id, 
map_index) ON DELETE CASCADE
       TABLE "task_map" CONSTRAINT "task_map_task_instance_fkey" FOREIGN KEY 
(dag_id, task_id, run_id, map_index) REFERENCES task_instance(dag_id, task_id, 
run_id, map_index) ON DELETE CASCADE
       TABLE "task_reschedule" CONSTRAINT "task_reschedule_ti_fkey" FOREIGN KEY 
(dag_id, task_id, run_id, map_index) REFERENCES task_instance(dag_id, task_id, 
run_id, map_index) ON DELETE CASCADE
       TABLE "xcom" CONSTRAINT "xcom_task_instance_fkey" FOREIGN KEY (dag_id, 
task_id, run_id, map_index) REFERENCES task_instance(dag_id, task_id, run_id, 
map_index) ON DELETE CASCADE
       TABLE "task_instance_note" CONSTRAINT "task_instance_note_ti_fkey" 
FOREIGN KEY (dag_id, task_id, run_id, map_index) REFERENCES 
task_instance(dag_id, task_id, run_id, map_index) ON DELETE CASCADE
       TABLE "rendered_task_instance_fields" CONSTRAINT "rtif_ti_fkey" FOREIGN 
KEY (dag_id, task_id, run_id, map_index) REFERENCES task_instance(dag_id, 
task_id, run_id, map_index) ON DELETE CASCADE
   
   Time: 0.025s
   ```



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