1fanwang opened a new pull request, #70340:
URL: https://github.com/apache/airflow/pull/70340

   `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
   
   <details><summary>Testing Done</summary>
   
   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.
   
   </details>
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: GitHub Copilot CLI following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
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]

Reply via email to