saitejabandaru-in opened a new pull request, #72235:
URL: https://github.com/apache/airflow/pull/72235

   Closes #72187.
   
   ### Motivation
   
   MySQL-compatible backends like Vitess/PlanetScale do not support CTEs in DML 
statements. When `SchedulerJobRunner._update_asset_orphanage` runs its asset 
reference-count query as a CTE and executes a `DELETE`, the query planner 
rejects it. Because this runs on the parsing cleanup interval, it causes the 
scheduler to crash-loop.
   
   ### Changes
   
   - Replaced `.cte()` with `.subquery()` for both `orphan_query` and 
`activate_query` in `_update_asset_orphanage`.
   - Updated the type hints for `assets_query` in `_orphan_unreferenced_assets` 
and `_activate_referenced_assets` from `CTE` to `Subquery`.
   
   Since each query is consumed by a single statement, the CTE is not 
semantically required and a standard derived-table subquery achieves the same 
outcome. This unblocks deployments on Vitess without changing query semantics 
for Postgres or standard MySQL.


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