This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new dbb4b59dcb Restore removed (but used) methods in common.sql (#27843)
dbb4b59dcb is described below

commit dbb4b59dcbc8b57243d1588d45a4d2717c3e7758
Author: Jarek Potiuk <[email protected]>
AuthorDate: Wed Nov 23 11:12:41 2022 +0100

    Restore removed (but used) methods in common.sql (#27843)
    
    * 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
---
 airflow/providers/common/sql/operators/sql.py | 29 +++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/airflow/providers/common/sql/operators/sql.py 
b/airflow/providers/common/sql/operators/sql.py
index 8dee6ed968..ffd3a6fcf9 100644
--- a/airflow/providers/common/sql/operators/sql.py
+++ b/airflow/providers/common/sql/operators/sql.py
@@ -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 = {

Reply via email to