Introduction to saved queries

Saved queries let you create, manage, and share SQL scripts in BigQuery. Changes to a saved query are automatically saved so that you don't lose your work when you close the query editor. Saved query capabilities are available only in the Google Cloud console.

About saved queries

Saved queries improve collaboration and query management with the following options:

  • Share saved queries with specific users and groups by using Identity and Access Management (IAM).
  • Review the query version history.
  • Revert to or branch from previous versions of the query.

Saved queries are BigQuery Studio code assets powered by Dataform. Notebooks are also code assets. All code assets are stored in a default region. Updating the default region changes the region for all code assets created after that point.

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 leaf icon Low CO2
Iowa us-central1 leaf icon Low CO2
Los Angeles us-west2
Las Vegas us-west4
Montréal northamerica-northeast1 leaf icon Low CO2
N. Virginia us-east4
Oregon us-west1 leaf icon Low CO2
São Paulo southamerica-east1 leaf icon Low CO2
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 leaf icon Low CO2
Finland europe-north1 leaf icon Low CO2
Frankfurt europe-west3
London europe-west2 leaf icon Low CO2
Madrid europe-southwest1 leaf icon Low CO2
Milan europe-west8 leaf icon Low CO2
Netherlands europe-west4 leaf icon Low CO2
Turin europe-west12 leaf icon Low CO2
Warsaw europe-central2 leaf icon Low CO2
Zürich europe-west6 leaf icon Low CO2
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:

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 Google Cloud 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) includes roles/dataform.admin permissions.
  • BigQuery Job User (roles/bigquery.jobUser) and BigQuery User (roles/bigquery.user) include:
    • dataform.locations.get
    • dataform.locations.list
    • dataform.repositories.create
    • dataform.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