This is an automated email from the ASF dual-hosted git repository.

amoghdesai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new e6c0793b273 Do not allow semicolon in partition_clause (#48098)
e6c0793b273 is described below

commit e6c0793b27313a6eae918a90661e5f68231f7687
Author: Amogh Desai <[email protected]>
AuthorDate: Sat Mar 22 21:03:59 2025 +0530

    Do not allow semicolon in partition_clause (#48098)
---
 .../sql/src/airflow/providers/common/sql/operators/sql.py | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git 
a/providers/common/sql/src/airflow/providers/common/sql/operators/sql.py 
b/providers/common/sql/src/airflow/providers/common/sql/operators/sql.py
index 9881906dd2e..2b20b1ee6bc 100644
--- a/providers/common/sql/src/airflow/providers/common/sql/operators/sql.py
+++ b/providers/common/sql/src/airflow/providers/common/sql/operators/sql.py
@@ -478,7 +478,7 @@ class SQLColumnCheckOperator(BaseSQLOperator):
 
         self.table = table
         self.column_mapping = column_mapping
-        self.partition_clause = partition_clause
+        self.partition_clause = _initialize_partition_clause(partition_clause)
         self.accept_none = accept_none
 
         def _build_checks_sql():
@@ -699,7 +699,7 @@ class SQLTableCheckOperator(BaseSQLOperator):
 
         self.table = table
         self.checks = checks
-        self.partition_clause = partition_clause
+        self.partition_clause = _initialize_partition_clause(partition_clause)
         self.sql = f"SELECT check_name, check_result FROM 
({self._generate_sql_query()}) AS check_table"
 
     def execute(self, context: Context):
@@ -1243,3 +1243,14 @@ class BranchSQLOperator(BaseSQLOperator, SkipMixin):
 
         # TODO(potiuk) remove the type ignore once we solve provider <-> Task 
SDK relationship
         self.skip_all_except(context["ti"], follow_branch)  # type: 
ignore[arg-type]
+
+
+def _initialize_partition_clause(clause: str | None) -> str | None:
+    """Ensure the partition_clause contains only valid patterns."""
+    if clause is None:
+        return None
+
+    if ";" in clause:
+        raise ValueError("Invalid partition_clause: semicolons (;) not 
allowed.")
+
+    return clause

Reply via email to