Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to point a jobs in Bigquery to a especific reservation

I had a reservation that I use for a current pipeline job and for feed one Metabase. I want to create a new reservation in this project to point out all these queries from Metabase, but I can't find how to set this like in the docs below. I'd like to know if it is possible or if I need to create a new project with a new reservation to get the role bigquery.jobs and run all the queries from this new project.

 
 
Solved Solved
0 3 1,884
1 ACCEPTED SOLUTION

Yes, you can create a new project with a new reservation and use it to run Metabase queries, even if the old project has another reservation.

To do this, you will need to:

  1. Create a new service account in the new project and grant it the Data Viewer role in the old project and the Job User role in the new project.
  2. Update the Metabase connection settings to use the new service account.

Once you have done this, all Metabase queries will be run using the new reservation in the new project.

Here is a step-by-step guide:

  1. Go to the IAM & Admin page in the Google Cloud Platform Console.

  2. Click Create Service Account.

  3. Enter a name and description for the service account.

  4. Select the BigQuery Data Viewer and BigQuery Job User roles.

  5. Click Create.

  6. Click Create Key and select JSON as the key type.

  7. Click Create.

  8. Download the JSON key file and save it to a secure location.

  9. Go to the Metabase Admin page.

  10. Click + Add Database.

  11. Select BigQuery as the database type.

  12. Enter the following information:

    • Name: A name for the database connection.
    • Project ID: The project ID of the new project.
    • Service account JSON file:The JSON key file that you downloaded in step 7.
  13. Click Save.

Now, when you run a Metabase query, it will use the new reservation in the new project.

Note: If you have any existing Metabase queries that are pointing to the old reservation, you will need to update them to point to the new reservation. To do this, go to the query settings and select the new reservation from the Reservation drop-down menu.

View solution in original post

3 REPLIES 3

To point a job in BigQuery to a specific reservation, you need to create an assignment between the project or folder that contains the job and the reservation.

Steps:

  1. Go to the BigQuery console.
  2. In the navigation pane, go to Capacity Management > Reservations.
  3. Find the reservation that you want to use.
  4. Click Create assignment.
  5. In the Create an assignment section, click Browse.
  6. Browse or search for the project or folder that contains the job, and select it.
  7. In the Job Type section, select the job type that you want to assign to the reservation.
  8. Click Create.

Once you have created an assignment, all jobs of the selected job type that are started from the project or folder will use the specified reservation.

To point all the queries from Metabase to a new reservation in the same project, you can follow these steps:

  1. Create a new reservation.
  2. Create an assignment between the project and the new reservation, selecting QUERY as the job type.
  3. Note: Metabase does not currently have a direct setting to specify a BigQuery reservation. Therefore, jobs run from Metabase will be assigned to reservations based on the assignment rules set up in BigQuery.

Additional tips:

  • You can assign a project or folder to multiple reservations.
  • You can assign a reservation to multiple projects or folders.
  • You can also assign an organization to a reservation.
  • You can view the current assignments for a reservation by clicking the Assignments tab.
  • You can remove an assignment by clicking the Delete button next to the assignment.

So if I create a new project with a new reservation and insert in Metabase a service account with a Data Viewer role in the old project and jobsUser role in the new project can I run queries in Metabase and use this new reservation even if the old project has another reservation?

Yes, you can create a new project with a new reservation and use it to run Metabase queries, even if the old project has another reservation.

To do this, you will need to:

  1. Create a new service account in the new project and grant it the Data Viewer role in the old project and the Job User role in the new project.
  2. Update the Metabase connection settings to use the new service account.

Once you have done this, all Metabase queries will be run using the new reservation in the new project.

Here is a step-by-step guide:

  1. Go to the IAM & Admin page in the Google Cloud Platform Console.

  2. Click Create Service Account.

  3. Enter a name and description for the service account.

  4. Select the BigQuery Data Viewer and BigQuery Job User roles.

  5. Click Create.

  6. Click Create Key and select JSON as the key type.

  7. Click Create.

  8. Download the JSON key file and save it to a secure location.

  9. Go to the Metabase Admin page.

  10. Click + Add Database.

  11. Select BigQuery as the database type.

  12. Enter the following information:

    • Name: A name for the database connection.
    • Project ID: The project ID of the new project.
    • Service account JSON file:The JSON key file that you downloaded in step 7.
  13. Click Save.

Now, when you run a Metabase query, it will use the new reservation in the new project.

Note: If you have any existing Metabase queries that are pointing to the old reservation, you will need to update them to point to the new reservation. To do this, go to the query settings and select the new reservation from the Reservation drop-down menu.