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 job_id/project_id to adapter response to enable easy job linking (fixed) #250

Merged
merged 1 commit into from
Aug 8, 2022

Conversation

Kayrnt
Copy link
Contributor

@Kayrnt Kayrnt commented Aug 4, 2022

resolves #92

Description

Adding job_id / project_id from the job executed by BQ to add a clean link to explore the runtime in the BQ UI.

Practically, it adds a link in your -d runs such as:

13:28:11.169553 [debug] [Thread-1 (]: BigQuery adapter: Job details accessible at https://console.cloud.google.com/bigquery?project=<project>&j=bq:<location>:<jobId>&page=queryresults

Fixed version following revert from #225

Checklist

  • I have signed the CLA
  • 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
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-bigquery next" section.

@cla-bot cla-bot bot added the cla:yes label Aug 4, 2022
if hasattr(error, "query_job"):
logger.error(
cls._bq_job_link(
error.query_job.location, error.query_job.project, error.query_job.job_id
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previous PR had error.query_job.project_id instead of error.query_job.project which was a typo on my end
https://cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJob#google_cloud_bigquery_job_QueryJob_project

@Kayrnt Kayrnt changed the title Job Add job_id/project_id to adapter response to enable easy job linking (fixed) Aug 4, 2022
@Kayrnt
Copy link
Contributor Author

Kayrnt commented Aug 4, 2022

I ran locally:

  dbt-bigquery git:(job_id) ✗ python -m pytest tests/functional/adapter/test_incremental_unique_id.py
========================================================================================================= test session starts ==========================================================================================================
platform darwin -- Python 3.10.5, pytest-7.1.2, pluggy-1.0.0
rootdir: /Users/christophe.oudar/dev/opensource/dbt-bigquery, configfile: pytest.ini
plugins: xdist-2.5.0, forked-1.4.0, csv-3.0.0, logbook-1.2.0, flaky-3.7.0, dotenv-0.5.2
collected 10 items

tests/functional/adapter/test_incremental_unique_id.py ..........                                                                                                                                                                [100%]

=========================================================================================================== warnings summary ===========================================================================================================
tests/functional/adapter/test_incremental_unique_id.py::TestUniqueKeyBigQuery::test__no_unique_keys
tests/functional/adapter/test_incremental_unique_id.py::TestUniqueKeyBigQuery::test__no_unique_keys
  /opt/homebrew/lib/python3.10/site-packages/google/auth/_default.py:81: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. We recommend you rerun `gcloud auth application-default login` and make sure a quota project is added. Or you can use service accounts instead. For more information about service accounts, see https://cloud.google.com/docs/authentication/

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================== 10 passed, 2 warnings in 280.89s (0:04:40) ==============================================================================================

So it looks like the failing test from previous PR is now passing 🤔

@McKnight-42 McKnight-42 added the ready_for_review Externally contributed PR has functional approval, ready for code review from Core engineering label Aug 4, 2022
@McKnight-42 McKnight-42 closed this Aug 4, 2022
@McKnight-42 McKnight-42 reopened this Aug 4, 2022
@Kayrnt
Copy link
Contributor Author

Kayrnt commented Aug 4, 2022

It looks like all tests are successful this time 🚀

@McKnight-42
Copy link
Contributor

@Kayrnt This is looking great ran the tests locally on my end as well and passing, the conflicts that are showing up are because we just added changie to dbt-bigquery so you might need to update to main and change your changelog entry please ask me if you have any questions about how that works. the dbt-core contributing docs are also a great source of information.

will ping some others to get double checks on this!

@Kayrnt
Copy link
Contributor Author

Kayrnt commented Aug 6, 2022

I've updated the PR with changie approach

Copy link
Contributor

@McKnight-42 McKnight-42 left a comment

Choose a reason for hiding this comment

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

have tested locally, looking very good will merge in and keep eye on tests on main

@McKnight-42 McKnight-42 merged commit 764f5fe into dbt-labs:main Aug 8, 2022
@jtcohen6
Copy link
Contributor

jtcohen6 commented Aug 8, 2022

Hooray! Thanks both for checking back into this, and getting it merge-ready 🚀

@MartinNowak MartinNowak mentioned this pull request Sep 23, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes ok to test ready_for_review Externally contributed PR has functional approval, ready for code review from Core engineering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide jobIds behind model creation in run_results.json
4 participants