Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 0c5422c

Browse files
fix 409 duplicate batch issue (#1020)
* use dynamic schema in test_grant_access_to.py * use dynamic schema in test_grant_access_to.py * revert setup * fix partitioninb * skip TestPythonBatchIdModels * add changie * run python integration tests separately * run python integration tests separately * cleanup _get_batch_id * add space to pipe * fix integration.yml * add extra changie * use dynamic schema in test_grant_access_to.py * use dynamic schema in test_grant_access_to.py * revert setup * replace deterministic default batch_id with uuid * add changie
1 parent 9e39acf commit 0c5422c

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Fixes
2+
body: replace deterministic batch_id with uuid
3+
time: 2023-11-11T15:09:59.243797-08:00
4+
custom:
5+
Author: colin-rogers-dbt
6+
Issue: "1006"

dbt/adapters/bigquery/python_submissions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import uuid
12
from typing import Dict, Union
23

34
from dbt.events import AdapterLogger
@@ -126,8 +127,7 @@ def _get_job_client(self) -> dataproc_v1.BatchControllerClient:
126127

127128
def _get_batch_id(self) -> str:
128129
model = self.parsed_model
129-
default_batch_id = model["unique_id"].replace(".", "-").replace("_", "-")
130-
default_batch_id += str(int(model["created_at"]))
130+
default_batch_id = str(uuid.uuid4())
131131
return model["config"].get("batch_id", default_batch_id)
132132

133133
def _submit_dataproc_job(self) -> Batch:

tests/functional/adapter/test_python_model.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ def model(dbt, spark):
187187
models:
188188
- name: python_array_batch_id
189189
description: A random table with a calculated column defined in python.
190-
config:
191-
batch_id: '{{ run_started_at.strftime("%Y-%m-%d-%H-%M-%S") }}-python-array'
192190
columns:
193191
- name: A
194192
description: Column A
@@ -216,7 +214,6 @@ def model(dbt, spark):
216214
"""
217215

218216

219-
@pytest.mark.skip(reason="Currently failing as run_started_at is the same across dbt runs")
220217
class TestPythonBatchIdModels:
221218
@pytest.fixture(scope="class")
222219
def models(self):

0 commit comments

Comments
 (0)