From f37649711b618a0a864ed3c3c2531e40ca81f2ba Mon Sep 17 00:00:00 2001 From: Matt Rouhana Date: Wed, 8 Nov 2023 22:22:16 -0500 Subject: [PATCH] refactor(core): UUID suffix instead of Unix timestamp --- target_bigquery/core.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target_bigquery/core.py b/target_bigquery/core.py index c7e0d82..2b48ce0 100644 --- a/target_bigquery/core.py +++ b/target_bigquery/core.py @@ -17,6 +17,7 @@ import sys import time import traceback +import uuid from abc import ABC, abstractmethod try: @@ -315,7 +316,7 @@ def __init__( and self._is_upsert_candidate() ): self.merge_target = copy(self.table) - self.table = BigQueryTable(name=f"{self.table_name}__{int(time.time())}", **opts) + self.table = BigQueryTable(name=f"{self.table_name}__{uuid.uuid4()}", **opts) self.table.create_table( self.client, self.apply_transforms, @@ -333,7 +334,7 @@ def __init__( time.sleep(2.5) # Wait for eventual consistency elif self._is_overwrite_candidate(): self.overwrite_target = copy(self.table) - self.table = BigQueryTable(name=f"{self.table_name}__{int(time.time())}", **opts) + self.table = BigQueryTable(name=f"{self.table_name}__{uuid.uuid4()}", **opts) self.table.create_table( self.client, self.apply_transforms,