Skip to content

Validate DatabricksCopyIntoOperator template fields after rendering - #70339

Merged
shahar1 merged 3 commits into
apache:mainfrom
1fanwang:fix-databricks-copy-init
Jul 24, 2026
Merged

Validate DatabricksCopyIntoOperator template fields after rendering#70339
shahar1 merged 3 commits into
apache:mainfrom
1fanwang:fix-databricks-copy-init

Conversation

@1fanwang

Copy link
Copy Markdown
Contributor

files, table_name and file_location are template fields, so they are rendered after __init__ runs. The constructor checked files/pattern mutual exclusivity and rejected an empty table_name/file_location there, acting on the un-rendered Jinja expressions — so a templated table_name couldn't resolve before the empty check ran. Move those three checks into execute(). The file_format check reads no template field and stays in __init__.

related: #70296

Testing Done

New test_files_and_pattern_rejected_at_execute constructs with both files and pattern and asserts the AirflowException now surfaces from execute(). It fails on the pre-fix source (the constructor raises first) and passes after. test_databricks_sql.py: 52 passed. validate_operators_init.py exits 0 and 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

files, table_name and file_location are template fields, rendered after __init__
runs. The constructor checked files/pattern mutual exclusivity and rejected empty
table_name/file_location there, acting on the un-rendered Jinja expressions. Move
those three checks into execute(); the file_format check reads no template field
and stays in __init__.

related: apache#70296
Signed-off-by: 1fanwang <1fannnw@gmail.com>
…time checks

The files/pattern, empty table_name and empty file_location checks moved from
__init__ to execute(); trigger them via execute() in test_databricks_copy.py and
drop the now-redundant duplicate added in test_databricks_sql.py.

Signed-off-by: 1fanwang <1fannnw@gmail.com>
@1fanwang
1fanwang marked this pull request as draft July 24, 2026 05:47
Signed-off-by: 1fanwang <1fannnw@gmail.com>
@1fanwang
1fanwang marked this pull request as ready for review July 24, 2026 06:23
@shahar1
shahar1 merged commit 87acced into apache:main Jul 24, 2026
135 of 140 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