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

Bigquery: Enable User to Choose Job Priority in Profile #1456

Closed
davidjinlee opened this issue May 10, 2019 · 4 comments
Closed

Bigquery: Enable User to Choose Job Priority in Profile #1456

davidjinlee opened this issue May 10, 2019 · 4 comments
Labels
bigquery enhancement New feature or request good_first_issue Straightforward + self-contained changes, good for new contributors!

Comments

@davidjinlee
Copy link

Feature

Feature description

This would allow users to define the job priority (batch vs interactive) in their Bigquery profile. When a model is run using the profile with the job priority defined as "batch", DBT would block until the query is actually executed. This would allow for

The benefits of having ability to define the job priority:

  1. Allows users to queue up their jobs
  2. Lets users run lower priority queries without impacting higher priority ones
  3. Does not count towards concurrency quota
@drewbanin
Copy link
Contributor

Hey @davidjinlee - cool idea! Every query that dbt executes on BQ should go through the raw_execute() method. I think this will be the place to add this config.

The BQ docs seem to indicate that job priority can be configured with:

job_config = bigquery.QueryJobConfig()
job_config.priority = bigquery.QueryPriority.BATCH

We should be able to add a priority key to the profile config. That might look like:

my-profile:
  target: dev
  outputs:
    dev:
      type: bigquery
      method: oauth
      project: '....'
      priority: batch # one of batch|interactive, if provided

Then from the raw_execute method, we can access this config with:

priority = conn.credentials.get('priority', 'interactive')

How does all of that sound?

@davidjinlee
Copy link
Author

Hey @drewbanin just a couple questions! If we define job_config.priority = bigquery.QueryPriority.BATCH would that default all queries ran as "batch"? Would we want to have all queries default to "Interactive" unless the user has define "priority: batch" in the profile config? Or is that what priority = conn.credentials.get('priority', 'interactive') is doing?

@drewbanin
Copy link
Contributor

drewbanin commented May 13, 2019

You're absolutely right @davidjinlee!

This line of code will get the priority from the user's profiles.yml target. If no priority is specified, then we'll default to interactive (the existing behavior)

priority = conn.credentials.get('priority', 'interactive')

Next, we'll need to do a check to see if priority == 'interactive' or if priority == 'batch'.

If it's interactive, then we'll want to do:

job_config.priority = bigquery.QueryPriority.INTERACTIVE

and if it's batch, we'll want to do:

job_config.priority = bigquery.QueryPriority.BATCH

@drewbanin drewbanin added bigquery enhancement New feature or request good_first_issue Straightforward + self-contained changes, good for new contributors! labels Jul 11, 2019
@drewbanin
Copy link
Contributor

closed by #1673

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bigquery enhancement New feature or request good_first_issue Straightforward + self-contained changes, good for new contributors!
Projects
None yet
Development

No branches or pull requests

2 participants