You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/07/04 20:43:20 UTC

[airflow] branch main updated: perf(BigQuery): pass table_id as str type (#23141)

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

potiuk 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 fe13eae3bf perf(BigQuery): pass table_id as str type (#23141)
fe13eae3bf is described below

commit fe13eae3bf0542025e622e51a487f8d6a8b6d2c5
Author: Bryan <24...@users.noreply.github.com>
AuthorDate: Mon Jul 4 16:42:55 2022 -0400

    perf(BigQuery): pass table_id as str type (#23141)
---
 airflow/providers/google/cloud/hooks/bigquery.py    |  2 +-
 tests/providers/google/cloud/hooks/test_bigquery.py | 10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/airflow/providers/google/cloud/hooks/bigquery.py b/airflow/providers/google/cloud/hooks/bigquery.py
index 1ae2a4d4ab..1be077d790 100644
--- a/airflow/providers/google/cloud/hooks/bigquery.py
+++ b/airflow/providers/google/cloud/hooks/bigquery.py
@@ -1176,7 +1176,7 @@ class BigQueryHook(GoogleBaseHook, DbApiHook):
         :param project_id: the project used to perform the request
         """
         self.get_client(project_id=project_id).delete_table(
-            table=Table.from_string(table_id),
+            table=table_id,
             not_found_ok=not_found_ok,
         )
         self.log.info('Deleted table %s', table_id)
diff --git a/tests/providers/google/cloud/hooks/test_bigquery.py b/tests/providers/google/cloud/hooks/test_bigquery.py
index f143a14c91..2b378b1ec6 100644
--- a/tests/providers/google/cloud/hooks/test_bigquery.py
+++ b/tests/providers/google/cloud/hooks/test_bigquery.py
@@ -474,14 +474,12 @@ class TestBigQueryHookMethods(_BigQueryBaseTestClass):
             start_index=5,
         )
 
-    @mock.patch("airflow.providers.google.cloud.hooks.bigquery.Table")
     @mock.patch("airflow.providers.google.cloud.hooks.bigquery.Client")
-    def test_run_table_delete(self, mock_client, mock_table):
-        source_project_dataset_table = f"{PROJECT_ID}.{DATASET_ID}.{TABLE_ID}"
-        self.hook.run_table_delete(source_project_dataset_table, ignore_if_missing=False)
-        mock_table.from_string.assert_called_once_with(source_project_dataset_table)
+    def test_run_table_delete(self, mock_client):
+        source_dataset_table = f"{DATASET_ID}.{TABLE_ID}"
+        self.hook.run_table_delete(source_dataset_table, ignore_if_missing=False)
         mock_client.return_value.delete_table.assert_called_once_with(
-            table=mock_table.from_string.return_value, not_found_ok=False
+            table=source_dataset_table, not_found_ok=False
         )
 
     @mock.patch("airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.create_empty_table")