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/13 06:27:05 UTC

[GitHub] [airflow] dstandish opened a new pull request, #27024: Update WasbHook to reflect preference for unprefixed extra

dstandish opened a new pull request, #27024:
URL: https://github.com/apache/airflow/pull/27024

   Since 2.3 we don't need the extra prefix to edit custom fields with UI form.  From 2.5 we won't need to use the prefix in the ui form behaviors method either.
   


-- 
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


[GitHub] [airflow] rajaths010494 commented on a diff in pull request #27024: Update WasbHook to reflect preference for unprefixed extra

Posted by GitBox <gi...@apache.org>.
rajaths010494 commented on code in PR #27024:
URL: https://github.com/apache/airflow/pull/27024#discussion_r995707276


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -119,6 +150,17 @@ def __init__(
         except ValueError:
             logger.setLevel(logging.WARNING)
 
+    def _get_field(self, extra_dict, field_name):
+        prefix = 'extra__wasb__'
+        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:
   Is `None` needed to be returned when the key is present in the dict? 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


[GitHub] [airflow] dstandish commented on a diff in pull request #27024: Update WasbHook to reflect preference for unprefixed extra

Posted by GitBox <gi...@apache.org>.
dstandish commented on code in PR #27024:
URL: https://github.com/apache/airflow/pull/27024#discussion_r995889834


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -119,6 +150,17 @@ def __init__(
         except ValueError:
             logger.setLevel(logging.WARNING)
 
+    def _get_field(self, extra_dict, field_name):
+        prefix = 'extra__wasb__'
+        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:
   could be empty string



-- 
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


[GitHub] [airflow] dstandish merged pull request #27024: Update WasbHook to reflect preference for unprefixed extra

Posted by GitBox <gi...@apache.org>.
dstandish merged PR #27024:
URL: https://github.com/apache/airflow/pull/27024


-- 
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


[GitHub] [airflow] dstandish commented on a diff in pull request #27024: Update WasbHook to reflect preference for unprefixed extra

Posted by GitBox <gi...@apache.org>.
dstandish commented on code in PR #27024:
URL: https://github.com/apache/airflow/pull/27024#discussion_r995888509


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -119,6 +150,17 @@ def __init__(
         except ValueError:
             logger.setLevel(logging.WARNING)
 
+    def _get_field(self, extra_dict, field_name):
+        prefix = 'extra__wasb__'
+        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
+        return extra_dict.get(f"{prefix}{field_name}") or None

Review Comment:
   difference is empty string



-- 
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


[GitHub] [airflow] rajaths010494 commented on a diff in pull request #27024: Update WasbHook to reflect preference for unprefixed extra

Posted by GitBox <gi...@apache.org>.
rajaths010494 commented on code in PR #27024:
URL: https://github.com/apache/airflow/pull/27024#discussion_r995707276


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -119,6 +150,17 @@ def __init__(
         except ValueError:
             logger.setLevel(logging.WARNING)
 
+    def _get_field(self, extra_dict, field_name):
+        prefix = 'extra__wasb__'
+        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:
   Is returning `None` needed to be returned when the key is present in the dict? 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


[GitHub] [airflow] bharanidharan14 commented on a diff in pull request #27024: Update WasbHook to reflect preference for unprefixed extra

Posted by GitBox <gi...@apache.org>.
bharanidharan14 commented on code in PR #27024:
URL: https://github.com/apache/airflow/pull/27024#discussion_r995710621


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -119,6 +150,17 @@ def __init__(
         except ValueError:
             logger.setLevel(logging.WARNING)
 
+    def _get_field(self, extra_dict, field_name):
+        prefix = 'extra__wasb__'
+        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
+        return extra_dict.get(f"{prefix}{field_name}") or None

Review Comment:
   we also write like this `extra_dict.get(f"{prefix}{field_name}", None)` , its upto you



##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -119,6 +150,17 @@ def __init__(
         except ValueError:
             logger.setLevel(logging.WARNING)
 
+    def _get_field(self, extra_dict, field_name):
+        prefix = 'extra__wasb__'
+        if field_name.startswith('extra_'):

Review Comment:
   Same as the previous PR review comment, can we check for the exact key `extra__`



-- 
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


[GitHub] [airflow] dstandish commented on a diff in pull request #27024: Update WasbHook to reflect preference for unprefixed extra

Posted by GitBox <gi...@apache.org>.
dstandish commented on code in PR #27024:
URL: https://github.com/apache/airflow/pull/27024#discussion_r995892013


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -119,6 +150,17 @@ def __init__(
         except ValueError:
             logger.setLevel(logging.WARNING)
 
+    def _get_field(self, extra_dict, field_name):
+        prefix = 'extra__wasb__'
+        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:
   i like to treat empty string as none in this context because UI creates all custom fields with empty string even if not supplied



-- 
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


[GitHub] [airflow] rajaths010494 commented on a diff in pull request #27024: Update WasbHook to reflect preference for unprefixed extra

Posted by GitBox <gi...@apache.org>.
rajaths010494 commented on code in PR #27024:
URL: https://github.com/apache/airflow/pull/27024#discussion_r995893002


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -119,6 +150,17 @@ def __init__(
         except ValueError:
             logger.setLevel(logging.WARNING)
 
+    def _get_field(self, extra_dict, field_name):
+        prefix = 'extra__wasb__'
+        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:
   ok



-- 
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


[GitHub] [airflow] dstandish commented on a diff in pull request #27024: Update WasbHook to reflect preference for unprefixed extra

Posted by GitBox <gi...@apache.org>.
dstandish commented on code in PR #27024:
URL: https://github.com/apache/airflow/pull/27024#discussion_r995890650


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -119,6 +150,17 @@ def __init__(
         except ValueError:
             logger.setLevel(logging.WARNING)
 
+    def _get_field(self, extra_dict, field_name):
+        prefix = 'extra__wasb__'
+        if field_name.startswith('extra_'):

Review Comment:
   sure



-- 
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