-
Notifications
You must be signed in to change notification settings - Fork 149
-
Notifications
You must be signed in to change notification settings - Fork 149
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
Integration test for query-comment as BigQuery job label #28
Comments
@jtcohen6 I'd be willing to take a crack at this! Can I ask a question about how you'd implement these tests? I started doodling around, hit a bit of a block around running the query you suggested. This function stub in my test...
...raises an Did a little digging and looks like the reason is that the Which would explain why I can do a dbt run but can't |
@anthonymichaelclark Glad to have you on board! It doesn't surprise me to hear that the integration test I haven't had a chance to dive into the code here just yet, so just from quickly looking—I don't follow why line 313 would raise an AttributeError, if the condition in line 312 gives the all-clear? |
@jtcohen6 Ah, should've included that bit in my test stub -- I've set the project_config in the test class like so:
So when I call |
@anthonymichaelclark Ah... because I suppose one straightforward way of fixing this, enough to unblock the integration test without changing any functionality in practice, would be to update the conditional logic: if (
self.profile.query_comment and
self.profile.query_comment.job_label and
self.query_header.comment.query_comment
): That doesn't seem outlandish to me. What do you think? |
@jtcohen6 Yeah that'd work! Wasn't sure if I should be looking for a "deeper" fix -- I'll do that^ and get on with writing the tests |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days. |
Describe the feature
dbt-labs/dbt-core#3145 did something really cool: By setting in dbt_project.yml:
dbt will supply the key-value pairs from a query comment dictionary (or the full value as one key-value pair, if the query comment is a non-dict string) to BigQuery as a job label for the queries representing node execution:
In order to really test that this is working, and avoid regression, we should add an integration test that:
query-comment
and checks that the labels appropriately registered, by queryingINFORMATION_SCHEMA.JOBS_BY_USER
. (We'd want that query to filter onuser_email
andcreation_time
.)query-comment
, checks the samejob-label: false
and ensures that only the default job label (invocation_id
) is appliedDescribe alternatives you've considered
Not integration testing this.
dbt-labs/dbt-core#3145 added unit testing for the python dict/string handling functions, so the nuts and bolts are in place. In order for this to be a feature that dbt-bigquery users can feel comfortable relying on, we need to ensure that it will continue working in future releases, which may touch
query-comment
functionality in indirect ways.The text was updated successfully, but these errors were encountered: