dbt-labs / dbt-labs/dbt

[Bug] BigQuery labels in model and dbt_project.yml are not additive

Open
#9,525 1 comment 1 reaction 0 assignees View on GitHub
engine:v1 type:bug
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

### Is this a new bug in dbt-core?

- [X] I believe this is a new bug in dbt-core
- [X] I have searched the existing issues, and I could not find an existing issue for this bug

### 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-core/assets/16131590/08d2f92f-1a38-410d-9c06-5f101c73bc35)

### 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
```

### Which database adapter are you using with dbt?

bigquery

### 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.