How to save a query in Bigquery

How to save a query in Bigquery

How to save a query in Bigquery

May 19, 2024

How to save a query in Bigquery
How to save a query in Bigquery

bigquery save query

Bigquery saved queries missing? don't find find saved queries in bigquery?

Here's a quick guide how not to lose them again.

  1. First, create a new query in the BigQuery web UI or using the bq command-line tool.

  2. After running the query, click on the "Save" button located at the top-right corner of the query results tab.

  3. Enter a name for the saved query and select a location to save it to. You can choose to save it to a specific project or dataset.

  4. Choose the access level for the saved query, either "private" or "shared".

  5. Click on "Save" to save the query.

  6. If you want to access the saved query later, go to the "Queries" tab in the BigQuery web UI, and find the query in the location you saved it to.

  7. If you are using the command line tool, you can list all saved queries by running bq ls -j --all command

  8. To run the saved query, use the bq query command followed by the name of the saved query.

How to save a bigquery query with Sherloq

An alternative way to save queries easily is through the use of the Sherloq chrome extension. This extension allows you to save and organize queries directly from the BigQuery web UI with just a few clicks. Some of the advantages of using Sherloq over the built-in functionality in BigQuery include:

  1. Easily sharing queries among your team: Sherloq allows you to share your saved queries with specific individuals or groups, making it easy to collaborate with others.

  2. Organized by folder: Sherloq allows you to organize your saved queries into different folders, making it easy to find and access the queries you need.

  3. Version control and editing: Sherloq provides version control and the ability to edit your queries directly within the extension, so you can keep track of changes and easily revert to previous versions if needed.

To start saving your queries download Sherloq Chrome extension