Skip to content

Commit

Permalink
Restore removed (but used) methods in common.sql (#27843)
Browse files Browse the repository at this point in the history
* Restore removed (but used) methods in common.sql

Unfortunately two of the methods that have been removed in #26761
have been used in Google Provider 8.4.0

Those methods should be restored and 1.3.0 version of the
common.sql has to be yanked to get rid of the problem when
Bigquery is broken by common.sql

Fixes: #27838
  • Loading branch information
potiuk committed Nov 23, 2022
1 parent 0b0d299 commit dbb4b59
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions airflow/providers/common/sql/operators/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,35 @@ def _parse_boolean(val: str) -> str | bool:
raise ValueError(f"{val!r} is not a boolean-like string value")


def _get_failed_checks(checks, col=None):
"""
IMPORTANT!!! Keep it for compatibility with released 8.4.0 version of google provider.
Unfortunately the provider used _get_failed_checks and parse_boolean as imports and we should
keep those methods to avoid 8.4.0 version from failing.
"""
if col:
return [
f"Column: {col}\nCheck: {check},\nCheck Values: {check_values}\n"
for check, check_values in checks.items()
if not check_values["success"]
]
return [
f"\tCheck: {check},\n\tCheck Values: {check_values}\n"
for check, check_values in checks.items()
if not check_values["success"]
]


parse_boolean = _parse_boolean
"""
IMPORTANT!!! Keep it for compatibility with released 8.4.0 version of google provider.
Unfortunately the provider used _get_failed_checks and parse_boolean as imports and we should
keep those methods to avoid 8.4.0 version from failing.
"""


_PROVIDERS_MATCHER = re.compile(r"airflow\.providers\.(.*)\.hooks.*")

_MIN_SUPPORTED_PROVIDERS_VERSION = {
Expand Down

0 comments on commit dbb4b59

Please sign in to comment.