Is this your first time submitting a feature request?
Which version of dbt is this feature for?
dbt 1.x, dbt 2.x, tested with dbt-core==1.12.0
Describe the feature
#1964 introduced support for BigQuery labels (a dictionary of key=value pairs). Currently, model config overwrites the labels defined in dbt_project.yml completely. I propose a merge strategy per label key, so we can define labels for whole folders but also model-specific ones.
Minimal working example
- Prerequisites
$ mkdir mwe && cd mwe
$ uv venv && uv pip install 'dbt-core==1.12.0' 'dbt-bigquery==1.12.0'
- Create following files:
dbt_project.yml
name: 'labelstest'
profile: default
models:
labelstest:
+labels:
dbt_project: labelstest
intermediate:
+labels:
layer: intermediate
profiles.yml
default:
target: dev
outputs:
dev:
dataset: dbt
method: oauth
project: gcp-project-dev
type: bigquery
models/intermediate/itm_test.sql
{{ config(
materialized='view',
labels={'schedule': 'daily'},
) }}
- Running
dbt ls --output json --quiet | jq '.config.labels' will show:
But the expected value would be:
{
"schedule": "daily",
"layer": "intermediate",
"dbt_project": "labelstest"
}
Describe alternatives you've considered
The alternative is to not define labels in dbt_project.yml and only in the model files, but this gets repeatable and error prone quick.
Who will this benefit?
All users of BigQuery labels.
Are you interested in contributing this feature?
I might, but don't have any knowledge on the codebase so it might take a while
Yes, at least for the Python (v1.*`) version.
Anything else?
First implemented in #1964. I've created the issue on this repo because the PR that introduced the feature was made to this repo, but it might need to be transferred to https://github.com/dbt-labs/dbt-adapters?
Is this your first time submitting a feature request?
Which version of dbt is this feature for?
dbt 1.x, dbt 2.x, tested with dbt-core==1.12.0
Describe the feature
#1964 introduced support for BigQuery labels (a dictionary of key=value pairs). Currently, model config overwrites the labels defined in dbt_project.yml completely. I propose a merge strategy per label key, so we can define labels for whole folders but also model-specific ones.
Minimal working example
dbt_project.yml
profiles.yml
models/intermediate/itm_test.sql
{{ config( materialized='view', labels={'schedule': 'daily'}, ) }}dbt ls --output json --quiet | jq '.config.labels'will show:{ "schedule": "daily" }But the expected value would be:
{ "schedule": "daily", "layer": "intermediate", "dbt_project": "labelstest" }Describe alternatives you've considered
The alternative is to not define labels in dbt_project.yml and only in the model files, but this gets repeatable and error prone quick.
Who will this benefit?
All users of BigQuery labels.
Are you interested in contributing this feature?
I might, but don't have any knowledge on the codebase so it might take a whileYes, at least for the Python (v1.*`) version.
Anything else?
First implemented in #1964. I've created the issue on this repo because the PR that introduced the feature was made to this repo, but it might need to be transferred to https://github.com/dbt-labs/dbt-adapters?