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

Add BQ labels to all BQJobConfigs #795

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Alex-Krykun
Copy link

@Alex-Krykun Alex-Krykun commented Feb 5, 2025

resolves #774

Problem

Some of the jobs in dbt-bigquery adapters don't have BQ labeling.

Solution

Add missing labels attribute to all BQ Job Config objects.

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

def test_get_job_labels(self, mock_get_query_comment_labels):
query_labels = {"key": "value"}
expected = {**query_labels, "dbt_invocation_id": "uuid4"}
mock_get_query_comment_labels.return_value = self.connections._labels_from_query_comment(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mocking get_labels_from_query_comment to keep the test simple and unit test only get_job_labels, in another case have to create many obj for fully operational BigQueryConnectionManager instance. (https://github.com/dbt-labs/dbt-adapters/blob/main/dbt-bigquery/src/dbt/adapters/bigquery/connections.py#L213)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes The PR author has signed the CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Bigquery job labels missing when using CopyJobConfig in copy_bq_table
1 participant