Skip to content

Validate DatabricksSQLStatementsSensor statement fields after rendering - #70340

Merged
shahar1 merged 4 commits into
apache:mainfrom
1fanwang:fix-databricks-sql-sensor-init
Jul 24, 2026
Merged

Validate DatabricksSQLStatementsSensor statement fields after rendering#70340
shahar1 merged 4 commits into
apache:mainfrom
1fanwang:fix-databricks-sql-sensor-init

Conversation

@1fanwang

Copy link
Copy Markdown
Contributor

statement and statement_id are template fields, so they are rendered after __init__ runs. The constructor enforced their mutual exclusivity and presence there, acting on the un-rendered Jinja expressions — so a templated statement_id couldn't resolve before the check ran. Move both checks into execute(). The warehouse_id check reads no template field and stays in __init__.

related: #70296

Testing Done

New parametrized test_statement_combination_validated_at_execute covers both branches (both provided / neither provided) and asserts the AirflowException now surfaces from execute(). Both fail on the pre-fix source (the constructor raises first) and pass after. test_databricks.py (sensors): 22 passed. validate_operators_init.py exits 0; the raise AirflowException count is unchanged.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: GitHub Copilot CLI following the guidelines

statement and statement_id are template fields, rendered after __init__ runs. The
constructor enforced their mutual exclusivity and presence there, acting on the
un-rendered Jinja expressions. Move both checks into execute(); the warehouse_id
check reads no template field and stays in __init__.

related: apache#70296
Signed-off-by: 1fanwang <1fannnw@gmail.com>
Signed-off-by: 1fanwang <1fannnw@gmail.com>
@1fanwang
1fanwang marked this pull request as ready for review July 24, 2026 06:23

@shahar1 shahar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please resolve conflicts? (failed test seem transient)

1fanwang added 2 commits July 24, 2026 11:29
…sensor-init

Signed-off-by: 1fanwang <1fannnw@gmail.com>

# Conflicts:
#	scripts/ci/prek/validate_operators_init_exemptions.txt
Signed-off-by: 1fanwang <1fannnw@gmail.com>
@shahar1
shahar1 merged commit d369e6f into apache:main Jul 24, 2026
83 checks passed
@shahar1 shahar1 removed the backport-to-v3-3-test Backport to v3-3-test label Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants