kaxil commented on a change in pull request #4500: [AIRFLOW-3681] All GCP 
operators have now optional GCP Project ID
URL: https://github.com/apache/airflow/pull/4500#discussion_r247324268
 
 

 ##########
 File path: airflow/contrib/hooks/gcp_api_base_hook.py
 ##########
 @@ -144,11 +145,46 @@ def _get_field(self, f, default=None):
         key_path, etc. They get formatted as shown below.
         """
         long_f = 'extra__google_cloud_platform__{}'.format(f)
-        if long_f in self.extras:
+        if hasattr(self, 'extras') and long_f in self.extras:
             return self.extras[long_f]
         else:
             return default
 
     @property
     def project_id(self):
         return self._get_field('project')
+
+    def fallback_to_default_project_id(func):
+        """
+        Decorator that provides fallback for Google Cloud Platform project id. 
If
+        the project is None it will be replaced with the project_id from the
+        service account the Hook is authenticated with. Project id can be 
specified
+        either via project_id kwarg or via first parameter in positional args.
+        :param func: function to wrap
 
 Review comment:
   Need an empty line above this

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to