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

dstandish 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 680965b2ea Look for `extra__` instead of `extra_` in `get_field` 
(#27489)
680965b2ea is described below

commit 680965b2eac3a01124f01500b79d6714ecea13f5
Author: Daniel Standish <[email protected]>
AuthorDate: Thu Nov 3 12:00:37 2022 -0700

    Look for `extra__` instead of `extra_` in `get_field` (#27489)
    
    This reduces likelihood of false positive.  It's not possible as currently 
used.  But if someone were to add an extra field `extra_info` for example, that 
would cause trouble avoided by this change.
---
 airflow/providers/grpc/hooks/grpc.py            | 2 +-
 airflow/providers/jdbc/hooks/jdbc.py            | 2 +-
 airflow/providers/microsoft/azure/hooks/wasb.py | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/airflow/providers/grpc/hooks/grpc.py 
b/airflow/providers/grpc/hooks/grpc.py
index 6bf10d2827..eb12fd92d8 100644
--- a/airflow/providers/grpc/hooks/grpc.py
+++ b/airflow/providers/grpc/hooks/grpc.py
@@ -150,7 +150,7 @@ class GrpcHook(BaseHook):
     def _get_field(self, field_name: str):
         """Get field from extra, first checking short name, then for 
backcompat we check for prefixed name."""
         backcompat_prefix = "extra__grpc__"
-        if field_name.startswith("extra_"):
+        if field_name.startswith("extra__"):
             raise ValueError(
                 f"Got prefixed name {field_name}; please remove the 
'{backcompat_prefix}' prefix "
                 "when using this method."
diff --git a/airflow/providers/jdbc/hooks/jdbc.py 
b/airflow/providers/jdbc/hooks/jdbc.py
index 600ab093d4..56947af0eb 100644
--- a/airflow/providers/jdbc/hooks/jdbc.py
+++ b/airflow/providers/jdbc/hooks/jdbc.py
@@ -63,7 +63,7 @@ class JdbcHook(DbApiHook):
     def _get_field(self, extras: dict, field_name: str):
         """Get field from extra, first checking short name, then for 
backcompat we check for prefixed name."""
         backcompat_prefix = "extra__jdbc__"
-        if field_name.startswith("extra_"):
+        if field_name.startswith("extra__"):
             raise ValueError(
                 f"Got prefixed name {field_name}; please remove the 
'{backcompat_prefix}' prefix "
                 "when using this method."
diff --git a/airflow/providers/microsoft/azure/hooks/wasb.py 
b/airflow/providers/microsoft/azure/hooks/wasb.py
index 40653eea9b..3a7f481a90 100644
--- a/airflow/providers/microsoft/azure/hooks/wasb.py
+++ b/airflow/providers/microsoft/azure/hooks/wasb.py
@@ -149,7 +149,7 @@ class WasbHook(BaseHook):
 
     def _get_field(self, extra_dict, field_name):
         prefix = "extra__wasb__"
-        if field_name.startswith("extra_"):
+        if field_name.startswith("extra__"):
             raise ValueError(
                 f"Got prefixed name {field_name}; please remove the '{prefix}' 
prefix "
                 f"when using this method."

Reply via email to