Skip to content

Commit fe13eae

Browse files
authored
perf(BigQuery): pass table_id as str type (#23141)
1 parent 37ea530 commit fe13eae

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

airflow/providers/google/cloud/hooks/bigquery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ def delete_table(
11761176
:param project_id: the project used to perform the request
11771177
"""
11781178
self.get_client(project_id=project_id).delete_table(
1179-
table=Table.from_string(table_id),
1179+
table=table_id,
11801180
not_found_ok=not_found_ok,
11811181
)
11821182
self.log.info('Deleted table %s', table_id)

tests/providers/google/cloud/hooks/test_bigquery.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,14 +474,12 @@ def test_list_rows_with_empty_selected_fields(self, mock_client, mock_table):
474474
start_index=5,
475475
)
476476

477-
@mock.patch("airflow.providers.google.cloud.hooks.bigquery.Table")
478477
@mock.patch("airflow.providers.google.cloud.hooks.bigquery.Client")
479-
def test_run_table_delete(self, mock_client, mock_table):
480-
source_project_dataset_table = f"{PROJECT_ID}.{DATASET_ID}.{TABLE_ID}"
481-
self.hook.run_table_delete(source_project_dataset_table, ignore_if_missing=False)
482-
mock_table.from_string.assert_called_once_with(source_project_dataset_table)
478+
def test_run_table_delete(self, mock_client):
479+
source_dataset_table = f"{DATASET_ID}.{TABLE_ID}"
480+
self.hook.run_table_delete(source_dataset_table, ignore_if_missing=False)
483481
mock_client.return_value.delete_table.assert_called_once_with(
484-
table=mock_table.from_string.return_value, not_found_ok=False
482+
table=source_dataset_table, not_found_ok=False
485483
)
486484

487485
@mock.patch("airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.create_empty_table")

0 commit comments

Comments
 (0)