kaxil commented on code in PR #64173:
URL: https://github.com/apache/airflow/pull/64173#discussion_r2991668234
##########
providers/common/ai/src/airflow/providers/common/ai/utils/sql_validation.py:
##########
@@ -39,6 +39,18 @@
exp.Except,
)
+# Denylist: expression types that mutate data or schema when found anywhere in
the AST.
+# This catches data-modifying CTEs (e.g. WITH del AS (DELETE …) SELECT …),
+# SELECT INTO, and other constructs that bypass top-level type checks.
+_DATA_MODIFYING_NODES: tuple[type[exp.Expr], ...] = (
+ exp.Insert,
+ exp.Update,
+ exp.Delete,
+ exp.Merge,
+ exp.Into,
Review Comment:
No, I think the current design already handles this. When callers pass
custom `allowed_types`, the deep scan is skipped entirely (line 116: `if types
is DEFAULT_ALLOWED_TYPES:`). So users who need vendor-specific SQL that sqlglot
can't parse can provide their own `allowed_types` to opt out of the strict
checking. The fail-closed behavior only applies to the default read-only mode.
--
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]