Set up Gemini in BigQuery

Before you can use Gemini in BigQuery, your team needs to perform the setup steps that are described in this document:

  1. Activate Gemini in BigQuery. This step includes activating the necessary APIs and getting the necessary Identity and Access Management (IAM) permissions.
  2. Enable the Gemini in BigQuery features that you want to use.

Activate Gemini in BigQuery

To activate Gemini in BigQuery in a Google Cloud project, you need to enable the Cloud AI Companion API and grant IAM permissions to users. An administrator or project owner typically performs these steps.

To activate Gemini in BigQuery, follow these steps:

  1. Request access to Gemini in BigQuery. An administrator must complete the Gemini in BigQuery Pre-GA Sign-up form. Gemini in BigQuery pre-GA feature access is enabled in weekly batches.

  2. In the Google Cloud console, go to the BigQuery page.

    Go to BigQuery

  3. In the BigQuery toolbar, click pen_spark Gemini.

    If a list of features appears, then the Cloud AI Companion API is already enabled. You can select the BigQuery Studio features you want to enable. Otherwise, in the Introduction to Gemini in BigQuery dialog, click Continue to view a list of APIs that are required to use Gemini in BigQuery.

  4. For each required API, click Enable.

    The Cloud AI Companion API is required for Gemini. The Dataform API is required to enable BigQuery data canvas. If an API is not listed, then it is already enabled for your project.

  5. Click Next.

  6. To give users permission to use Gemini, in Permissions, grant them the Cloud AI Companion User IAM role.

  7. Click Next.

  8. In Check for subscription, confirm that you have access to Gemini. If you don't have access, click Learn more to learn how to gain access. Otherwise, click Done.

Enable Apache Spark in BigQuery

To use autotuning and assisted troubleshooting for Apache Spark, you must enable the Dataproc API for that 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

Enable Gemini in BigQuery features

If you're a data analyst, data scientist, or developer who wants to use specific Gemini in BigQuery features, then you might need to enable the feature in the Google Cloud console. For required enablement steps and IAM permissions, review the feature that you want to use:

Task Gemini in BigQuery feature Enable features or enable permissions
Explore and understand data Data insights from BigQuery metadata An administrator can do the following:
Discover, transform, query, and analyze data Data canvas An administrator can ensure that the Dataform API is enabled.
Get assisted SQL and Python data analysis Gemini assistance with queries An administrator can grant users the roles/cloudaicompanion.user role or give users the following IAM permissions:
  • cloudaicompanion.companions.generateCode
  • cloudaicompanion.entitlements.get
Users can enable the following Gemini features:
Get data infrastructure recommendations Recommendations for partitioning and clustering and materialized views An administrator can do the following::
Optimize and troubleshoot serverless Spark workloads Apache Spark in BigQuery autotuning and advanced troubleshooting An administrator can grant required permissions.

All of the users who have been granted required roles or permissions can access Gemini features in the Google Cloud console within the specified project. For more information, see Use Gemini for AI assistance and development.

What's next