From 2d59eae0aa4a5468ed8ba5d04e8d239e05e373ee Mon Sep 17 00:00:00 2001 From: Matt Rouhana <56656458+emesar@users.noreply.github.com> Date: Thu, 9 Nov 2023 21:43:38 -0500 Subject: [PATCH] refactor(core): UUID suffix instead of Unix timestamp (#72) --- 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,