You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/10/14 12:05:48 UTC

[GitHub] [airflow] bharanidharan14 commented on a diff in pull request #26764: Update snowflake hook to not use extra prefix

bharanidharan14 commented on code in PR #26764:
URL: https://github.com/apache/airflow/pull/26764#discussion_r995677205


##########
airflow/providers/snowflake/hooks/snowflake.py:
##########
@@ -153,31 +182,35 @@ def __init__(self, *args, **kwargs) -> None:
         self.session_parameters = kwargs.pop("session_parameters", None)
         self.query_ids: list[str] = []
 
+    def _get_field(self, extra_dict, field_name):
+        prefix = 'extra__snowflake__'
+        if field_name.startswith('extra_'):

Review Comment:
   Can we check for the exact string `extra__` . WDYT ?



##########
airflow/providers/snowflake/hooks/snowflake.py:
##########
@@ -153,31 +182,35 @@ def __init__(self, *args, **kwargs) -> None:
         self.session_parameters = kwargs.pop("session_parameters", None)
         self.query_ids: list[str] = []
 
+    def _get_field(self, extra_dict, field_name):
+        prefix = 'extra__snowflake__'
+        if field_name.startswith('extra_'):
+            raise ValueError(
+                f"Got prefixed name {field_name}; please remove the '{prefix}' prefix "
+                f"when using this method."
+            )
+        if field_name in extra_dict:
+            return extra_dict[field_name] or None

Review Comment:
   we can remove `or None`. WDYT



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org