meel-ayush commented on code in PR #76828:
URL: https://github.com/apache/airflow/pull/76828#discussion_r4634638904
##########
providers/common/sql/src/airflow/providers/common/sql/operators/sql.py:
##########
@@ -503,6 +503,10 @@ class SQLExecuteQueryOperator(BaseSQLOperator):
:param requires_result_fetch: (optional) if True, ensures that query
results are fetched before
completing execution. If `do_xcom_push` is True, results are fetched
automatically,
making this parameter redundant. (default: False).
+ :param validate_sql: (optional) if True, validates SQL syntax locally
before execution (default: False).
+ :param check_partition_filters: (optional) if True, checks for partition
filters and unbounded queries (default: False).
+ :param partition_columns: (optional) column names or mapping of table to
column names required in WHERE clauses.
Review Comment:
The AST only sees the query syntax, not table DDL or remote catalog metadata.
For example, SELECT * FROM tbl WHERE status = 'active' has a WHERE clause,
but status might not be the partition key. Without connecting to the live
database catalog, static AST parsing cannot determine which column physically
partitions the table.
check_partition_filters=True on its own prevents unbounded scans (requiring
a non-tautological WHERE or LIMIT). partition_columns lets the author enforce
that queries specifically filter on the required partition column(s).
--
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]