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 2020/05/11 08:15:36 UTC

[GitHub] [airflow] turbaszek commented on a change in pull request #8631: Refactor BigQuery hook methods to use python library

turbaszek commented on a change in pull request #8631:
URL: https://github.com/apache/airflow/pull/8631#discussion_r422863084



##########
File path: airflow/providers/google/cloud/hooks/bigquery.py
##########
@@ -512,84 +555,40 @@ def create_external_table(self,  # pylint: disable=too-many-locals,too-many-argu
                 }
         :type encryption_configuration: dict
         """
-        if not self.project_id:
-            raise ValueError("The project_id should be set")
-        service = self.get_service()
-
-        if src_fmt_configs is None:
-            src_fmt_configs = {}
-        project_id, dataset_id, external_table_id = \
-            _split_tablename(table_input=external_project_dataset_table,
-                             default_project_id=self.project_id,
-                             var_name='external_project_dataset_table')
-
-        # bigquery only allows certain source formats
-        # we check to make sure the passed source format is valid
-        # if it's not, we raise a ValueError
-        # Refer to this link for more details:
-        #   https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#externalDataConfiguration.sourceFormat # noqa # pylint: disable=line-too-long
 
+        warnings.warn(
+            "This method is deprecated. Please use `BigQueryHook.create_empty_table` method with"
+            "pass passing the `table_resource` object. This gives more flexibility than this method.",
+            DeprecationWarning,
+        )
+        project_id = project_id or self.project_id

Review comment:
       It works when provided `project_id` is `None` and the one defined on hook level is available. 




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

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