Validate DatabricksCopyIntoOperator template fields after rendering - #70339
Merged
Conversation
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>
1fanwang
requested review from
amoghrajesh,
ashb,
bugraoz93,
gopidesupavan,
jason810496,
jscheffl and
potiuk
as code owners
July 23, 2026 22:10
…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
marked this pull request as draft
July 24, 2026 05:47
Signed-off-by: 1fanwang <1fannnw@gmail.com>
1fanwang
marked this pull request as ready for review
July 24, 2026 06:23
shahar1
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
files,table_nameandfile_locationare template fields, so they are rendered after__init__runs. The constructor checkedfiles/patternmutual exclusivity and rejected an emptytable_name/file_locationthere, acting on the un-rendered Jinja expressions — so a templatedtable_namecouldn't resolve before the empty check ran. Move those three checks intoexecute(). Thefile_formatcheck reads no template field and stays in__init__.related: #70296
Testing Done
New
test_files_and_pattern_rejected_at_executeconstructs with bothfilesandpatternand asserts theAirflowExceptionnow surfaces fromexecute(). It fails on the pre-fix source (the constructor raises first) and passes after.test_databricks_sql.py: 52 passed.validate_operators_init.pyexits 0 and theraise AirflowExceptioncount is unchanged.Was generative AI tooling used to co-author this PR?
Generated-by: GitHub Copilot CLI following the guidelines