Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Big Query model-specific labels not transfered as job labels despite query-comment.job-label set to True #11277

Open
2 tasks done
AndresVelasco opened this issue Feb 5, 2025 · 0 comments
Labels
bug Something isn't working triage

Comments

@AndresVelasco
Copy link

Is this a new bug in dbt-core?

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

Current Behavior

Documentation states:
https://docs.getdbt.com/reference/project-configs/query-comment#bigquery-include-query-comment-items-as-job-labels

"If query-comment.job-label is set to true, dbt will include the query comment items, if a dictionary, or the comment string, as job labels on the query it executes. These will be included IN ADDITION TO labels specified in the BigQuery-specific config."

I then specify the following in dbt_project.yml:

query-comment:
  job-label: True

Standard query comment items are then also transfered to job labels, but not model specific labels.

{{
  config(
    materialized='table',
    labels = {'dummy_label': 'xxxx'}
  )
}}

Expected Behavior

I would expect that model specific labels defined in the models config block or yml are transferred as job labels, in addition to being set in the table's metadata.

Steps To Reproduce

profiles.yml:

dbt_test:
  outputs:
    dev:
      dataset: SYS_TMP
      job_execution_timeout_seconds: 300
      job_retries: 1
      location: EU
      method: oauth
      priority: interactive
      project: dacatalyst-nonprd
      threads: 1
      type: bigquery
  target: dev

dbt_project.yml:

# Name your project! Project names should contain only lowercase characters
# and underscores. A good package name should reflect your organization's
# name or the intended use of these models
name: 'dbt_test'
version: '1.0.0'

# This setting configures which "profile" dbt uses for this project.
profile: 'dbt_test'

# These configurations specify where dbt should look for different types of files.
# The `model-paths` config, for example, states that models in this project can be
# found in the "models/" directory. You probably won't need to change these!
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]

clean-targets:         # directories to be removed by `dbt clean`
  - "target"
  - "dbt_packages"


# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models

# In this example config, we tell dbt to build all models in the example/
# directory as views. These settings can be overridden in the individual model
# files using the `{{ config(...) }}` macro.
models:
  dbt_test:
    # Config indicated by + and applies to all files under models/example/
    example:
      +materialized: view

query-comment:
  job-label: True

```

model:

```
{{ config(materialized='table', labels={'dummy_label': 'xyz'}) }}

select 1 as dummy

```

run:

```
15:58:34  Running with dbt=1.9.1
15:58:35  Registered adapter: bigquery=1.9.0
15:58:35  [WARNING]: Configuration paths exist in your dbt_project.yml file which do not apply to any resources.
There are 1 unused configuration paths:
- models.dbt_test.example
15:58:35  Found 1 model, 489 macros, 1 unit test
15:58:35  
15:58:35  Concurrency: 1 threads (target='dev')
15:58:35  
15:58:39  1 of 1 START sql table model SYS_TMP.dummy ..................................... [RUN]
15:58:41  1 of 1 OK created sql table model SYS_TMP.dummy ................................ [CREATE TABLE (1.0 rows, 0 processed) in 2.30s]
15:58:41  
15:58:41  Finished running 1 table model in 0 hours 0 minutes and 6.18 seconds (6.18s).
15:58:41  
15:58:41  Completed successfully
15:58:41  
15:58:41  Done. PASS=1 WARN=0 ERROR=0 SKIP=0 TOTAL=1

```

Resulting job has standard query comment items as job labels but not model specific ones:


![Image](https://github.com/user-attachments/assets/08b9884b-dd0c-4f8b-b7d5-4329833b4d8b)`

### Relevant log output

```shell

```

### Environment

```markdown
- OS:
- Python:
- dbt:
```

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

bigquery

### Additional Context

_No response_
@AndresVelasco AndresVelasco added bug Something isn't working triage labels Feb 5, 2025
@AndresVelasco AndresVelasco changed the title [Bug] Big Query model labels not transmitted to job labels [Bug] Big Query model-specific labels not transfered as job labels despite query-comment.job-label set to True Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

1 participant