Set up Gemini in BigQuery

Before you can use Gemini in BigQuery, which offers AI-powered assistance for your data analytics, your team must do the following:

  1. Enable necessary APIs.
  2. Grant required Identity and Access Management (IAM) roles.
  3. Turn on Gemini in BigQuery features in the Google Cloud console.

Enable necessary APIs

To use Gemini in BigQuery, you must enable the Gemini for Google Cloud API. A service administrator or project owner with the serviceusage.services.enable IAM permission typically performs this step.

  1. To enable the Gemini for Google Cloud API, go to the Gemini for Google Cloud page.

    Go to Gemini for Google Cloud

  2. In the project selector, select a project.

  3. Click Enable.

    The page updates and shows a status of Enabled. Gemini in BigQuery is now available in the selected Google Cloud project to all users who have the required IAM permissions.

  4. To use recommendations for the partitioning and clustering recommender and materialized view recommender, enable the Recommender API if it's not already enabled.

Enable Apache Spark in BigQuery

To use autotuning and assisted troubleshooting for Apache Spark, you must enable the Dataproc API for a project.

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Enable the Dataproc API.

    Enable the API

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  6. Make sure that billing is enabled for your Google Cloud project.

  7. Enable the Dataproc API.

    Enable the API

Automatic enablement of asset management APIs

The following asset management APIs are automatically enabled for all Google Cloud projects that use BigQuery:

If you have automation scripts from before March 2024 that depended on the status of these APIs, you might need to update them.

These APIs don't incur any additional costs. Users that have IAM permissions to use enabled services on corresponding resources can incur charges, as described in BigQuery pricing, Dataform pricing, and Dataplex pricing.

You can prevent enablement of additional APIs by setting the Restrict Resource Service Usage organization policy constraint. You can disable selected APIs at any time.

Enable Gemini in BigQuery preview features

Certain Gemini in BigQuery features in Preview are part of the trusted tester program. To request access to these features, an administrator must complete the Gemini in BigQuery Pre-GA Sign-up form. Gemini in BigQuery pre-GA feature access is enabled periodically in batches.

Preview features that require Gemini in BigQuery sign-up include the following:

  • SQL query completion
  • Materialized view recommendations
  • Apache Spark autotuning and assisted troubleshooting

Grant IAM roles on a Google Cloud project

This section describes the steps required to grant the Cloud AI Companion User IAM role (roles/cloudaicompanion.user) to users. Additional roles are required for other Gemini in BigQuery features. An administrator typically performs this step.

  1. To grant the IAM roles that are required to use Gemini in BigQuery, go to the IAM & Admin page.

    Go to IAM & Admin

  2. To grant access, click View by principals.

  3. In the Principal column, find a principal for which you want to enable access to Gemini in BigQuery, and then click Edit principal in that row.

  4. In the Edit access pane, click Add another role.

  5. In the Select a role list, select Cloud AI Companion User. Users with the Cloud AI Companion User role can use Gemini for Google Cloud, but they might need additional permission to use specific Gemini in BigQuery features.

  6. Optional: Grant roles that give permissions to access other Gemini in BigQuery features, if necessary:

  7. Click Save.

Grant IAM roles for Gemini in BigQuery Apache Spark features

To grant the necessary IAM roles to use Gemini in BigQuery Apache Spark features to optimize with autotuning and to use advanced troubleshooting, see Dataproc Serverless roles.

Turn on Gemini in BigQuery features

If you're a data analyst, data scientist, or developer who wants to use specific Gemini in BigQuery features to write SQL queries and Python code, then you need to turn on the feature in the Google Cloud console. To learn how to turn on features, see Before you begin in "Write queries with Gemini assistance." Users who have the necessary IAM roles or permissions can access the Gemini in BigQuery features that are enabled for their Google Cloud project. For more information, see Gemini for Google Cloud overview.

What's next