Skip to content

Commit

Permalink
refactor(core): UUID suffix instead of Unix timestamp (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
emesar authored Nov 10, 2023
1 parent d9904b8 commit 2d59eae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions target_bigquery/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import sys
import time
import traceback
import uuid
from abc import ABC, abstractmethod

try:
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 2d59eae

Please sign in to comment.