Introduction to saved queries
Use saved queries in BigQuery to securely store, manage, and collaborate on your SQL scripts. As you work in the query editor, your changes are automatically saved to prevent accidental work loss.
Because saved queries are BigQuery Studio code assets powered by Dataform, they offer advanced collaboration and version control features. You can:
- Collaborate securely: share saved queries with specific users and groups using Identity and Access Management (IAM).
- Track changes: review a detailed version history of your query edits.
- Manage versions: branch from or revert to previous versions of a query to safely test modifications.
Saved query capabilities are available only in the Cloud de Confiance console.
Saved query security
You control access to saved queries by using Identity and Access Management (IAM) roles. For more information, see Share saved queries and Security considerations for saved queries.
Supported regions
All saved queries are stored in a default region. Updating the default region changes the location for any queries created after that point. The following table lists the regions where BigQuery Studio is available:
| Region description | Region name | Details | |
|---|---|---|---|
| Africa | |||
| Johannesburg | africa-south1 |
||
| Americas | |||
| Columbus | us-east5 |
||
| Dallas | us-south1 |
|
|
| Iowa | us-central1 |
|
|
| Los Angeles | us-west2 |
||
| Las Vegas | us-west4 |
||
| Montréal | northamerica-northeast1 |
|
|
| N. Virginia | us-east4 |
||
| Oregon | us-west1 |
|
|
| São Paulo | southamerica-east1 |
|
|
| South Carolina | us-east1 |
||
| Asia Pacific | |||
| Hong Kong | asia-east2 |
||
| Jakarta | asia-southeast2 |
||
| Mumbai | asia-south1 |
||
| Seoul | asia-northeast3 |
||
| Singapore | asia-southeast1 |
||
| Sydney | australia-southeast1 |
||
| Taiwan | asia-east1 |
||
| Tokyo | asia-northeast1 |
||
| Europe | |||
| Belgium | europe-west1 |
|
|
| Finland | europe-north1 |
|
|
| Frankfurt | europe-west3 |
||
| London | europe-west2 |
|
|
| Madrid | europe-southwest1 |
|
|
| Milan | europe-west8 |
|
|
| Netherlands | europe-west4 |
|
|
| Turin | europe-west12 |
|
|
| Warsaw | europe-central2 |
|
|
| Zürich | europe-west6 |
|
|
| Middle East | |||
| Dammam | me-central2 |
||
| Doha | me-central1 |
||
| Tel Aviv | me-west1 |
||
Quotas and limits
For more information, see the saved query quotas and limits.
Limitations
Saved queries have the following limitations:
- You can
grant public access to saved queries
only to the
allAuthenticatedUsersprincipal. You can't grant access to saved queries to theallUsersprincipal. - If your Cloud de Confiance project contains more than 2,500 classic saved queries, you can't use batch migration to migrate classic saved queries to saved queries.
Classic saved queries (Deprecated)
To edit existing classic saved queries after they are fully deprecated, you must migrate them to BigQuery Studio.
Classic saved queries are an older method for saving and sharing SQL. Unlike BigQuery Studio saved queries, they only retain the query text and the SQL version (legacy SQL or GoogleSQL).
In the Cloud de Confiance console, they appear in the (Classic) Queries folder within the Explorer pane. (If you haven't enabled BigQuery Studio, they appear in the Saved queries (NUMBER) folder in the Classic Explorer pane).
There are three types of classic saved queries:
Personal (): visible only to the user who created them.
- Note: If a personal query contains sensitive information, you must delete the query or remove the sensitive data prior to migration.
Project-level (): visible to any principal with the required permissions.
Public (): visible to anyone who has the link to the query.
IAM roles for migration and access
The following predefined BigQuery IAM roles include the required Dataform permissions to help you transition to BigQuery Studio saved queries:
- BigQuery Admin
(
roles/bigquery.admin) includesroles/dataform.adminpermissions. - BigQuery Job User
(
roles/bigquery.jobUser) and BigQuery User (roles/bigquery.user) include:dataform.locations.getdataform.locations.listdataform.repositories.createdataform.repositories.list
If you don't have one of these predefined roles, you request the required permissions. Custom roles aren't automatically updated and must be edited manually.
What's next
- To learn how to create saved queries, see Create saved queries.
- To learn how to manage saved queries, see Manage saved queries.