SQLCheckOperator fails if it returns dict with any Falsy values #36273
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.
closes: #34794
This PR modifys the SQLCheckOperator's behaviour in how it handles reading a Python
dict.Previously, if a Python
dictwas returned by the SQL query, the SQLCheckOperator would always pass. As suggested in the linked issue, if a Pythondictis returned it is recommended that if any of the dict's values are False-y , then the Operator should fail. This PR makes that change.For example, if the SQL query being tested returns:
{'DUPLICATE_ID_CHECK': False, 'NULL_VALUES_CHECK': True}then the operator should return False, since there is a Falsy value present.
The PR also adds an additional unit test and updated the documentation of the Operator.
Question for reviewers: I am concerned that users may be implementing this operator under the assumption that any
dictreturned means the task should pass. With this change, that would now lead to the task failing.