Skip to content

Commit

Permalink
Merge branch 'main' into dbeatty/primary-foreign-keys-not-enforced
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeatty10 authored Nov 16, 2023
2 parents 06df512 + 0c5422c commit 9fae687
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20231111-150959.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: replace deterministic batch_id with uuid
time: 2023-11-11T15:09:59.243797-08:00
custom:
Author: colin-rogers-dbt
Issue: "1006"
4 changes: 2 additions & 2 deletions dbt/adapters/bigquery/python_submissions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import uuid
from typing import Dict, Union

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

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

def _submit_dataproc_job(self) -> Batch:
Expand Down
3 changes: 0 additions & 3 deletions tests/functional/adapter/test_python_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ def model(dbt, spark):
models:
- name: python_array_batch_id
description: A random table with a calculated column defined in python.
config:
batch_id: '{{ run_started_at.strftime("%Y-%m-%d-%H-%M-%S") }}-python-array'
columns:
- name: A
description: Column A
Expand Down Expand Up @@ -216,7 +214,6 @@ def model(dbt, spark):
"""


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

0 comments on commit 9fae687

Please sign in to comment.