Skip to content

Commit

Permalink
Restore removed (but used) methods in common.sql
Browse files Browse the repository at this point in the history
Unfortunately two of the methods that have been removed in apache#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: apache#27838
  • Loading branch information
potiuk committed Nov 22, 2022
1 parent 9bae031 commit a055a80
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 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,36 @@ 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"]
]


def parse_boolean(val: str) -> str | bool:
"""
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.
"""
return _parse_boolean(val)


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

_MIN_SUPPORTED_PROVIDERS_VERSION = {
Expand Down

0 comments on commit a055a80

Please sign in to comment.