From b6a815e5392f0d1e7d20fe663c5c3eef1b9f5910 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Thu, 13 Jun 2024 17:47:52 +0000 Subject: [PATCH] fix: Fix temp table creation retries by now throwing if table already exists. --- bigframes/session/_io/bigquery/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bigframes/session/_io/bigquery/__init__.py b/bigframes/session/_io/bigquery/__init__.py index f26ca26c2a..c4d007be22 100644 --- a/bigframes/session/_io/bigquery/__init__.py +++ b/bigframes/session/_io/bigquery/__init__.py @@ -146,7 +146,9 @@ def create_temp_table( destination.schema = schema if cluster_columns: destination.clustering_fields = cluster_columns - bqclient.create_table(destination) + # Ok if already exists, since this will only happen from retries internal to this method + # as the requested table id has a random UUID4 component. + bqclient.create_table(destination, exists_ok=True) return f"{table_ref.project}.{table_ref.dataset_id}.{table_ref.table_id}"