GyuhoonK opened a new pull request, #72188: URL: https://github.com/apache/airflow/pull/72188
closes: #72187 The asset orphanage cleanup in the scheduler loop (`_update_asset_orphanage`) built its reference-count query as a CTE and passed it to a DELETE, producing `WITH ... DELETE FROM asset_active ...`. MySQL-compatible backends whose planner does not support CTEs in DML (e.g. Vitess / PlanetScale — `VT12001: unsupported: WITH expression in DELETE statement`) reject the statement at plan time, and since this runs on the `parsing_cleanup_interval` timer (default 60s) the scheduler crash-loops. The CTE is not semantically required: `orphan_query` and `activate_query` are each consumed by a single statement, so a plain derived-table subquery is equivalent. - `.cte()` → `.subquery()` for both queries; behavior is unchanged (`Subquery` exposes the same `.c` interface used by both consumers). - The DELETE now compiles (MySQL dialect) to `DELETE FROM asset_active WHERE EXISTS (SELECT * FROM (...) AS anon_1 WHERE ...)` — no `WITH`. The DELETE target `asset_active` is not referenced inside the subquery, so MySQL's self-reference restriction does not apply. - Type hints updated (`CTE` → `Subquery`); the now-unused `CTE` import removed. Dialect-compat precedent for this same method: #40349. Airflow 2.x is unaffected. Existing asset-orphanage tests cover the behavior (including the #58303 regression tests); this change only alters the SQL construct, not semantics. -- 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]
