dbt-labs / dbt-labs/dbt-adapters

[Feature] Change BigQuery `labels` to be additive instead of "clobber"

Open
#587 9 comments 5 reactions 0 assignees View on GitHub
pkg:dbt-bigquery type:enhancement
Dominant language
Python
Stars
233
Forks
362
Avg merge
3d 22h
Merged PRs (30d)
9

Description

### Current Behavior

When we set labels in `dbt_project.yml`
```
finance:
+labels:
domain: finance
test: "yes"
```

and then extra ones in the model file

```
{{
config(
labels = {"type": "financial", "contains_pii": "yes"}
)
}}
```

The configuration of the model gets overwritten, even though the labels are different.

![image](https://github.com/dbt-labs/dbt-adapters/assets/16131590/addb27af-529f-4dc9-8067-45e93fcbead8)

### Expected Behavior

I expected all labels to be applied and if a label is specified twice then for the single model configuration to take precedence.

### Steps To Reproduce

Create a sample model in folder `models/finance/finance_test.sql` and add the following configuration:

```
{{
config(
labels = {"type": "financial", "contains_pii": "yes"}
)
}}
```

In `dbt_project.yml` add the following configuration:

```
models:
project_name:
finance:
+labels:
domain: finance
test: yes
```

### Relevant log output

_No response_

### Environment

```markdown
- OS: Windows 10
- Python: 3.8.4rc1
- dbt: 1.7.7
- dbt-bigquery: 1.7.4
```

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.