[ Web Proxy ]
URL:
Viewing: https://docs.cloud.google.com/bigquery/docs/develop-with-gemini-cli [Back]  [Original]

Analyze data with the Gemini CLI  |  BigQuery  |  Google Cloud Documentation Skip to main content
Google Cloud Documentation [Google Cloud Documentation]
Send feedback Stay organized with collections Save and categorize content based on your preferences.

Analyze data with the Gemini CLI

This page explains how to interact with BigQuery data in your terminal by using natural-language prompts with the Gemini CLI. Using the dedicated BigQuery extensions with the Gemini CLI enables AI-driven data analysis and insights directly within your command line. You can analyze data from your BigQuery tables, or from tables in the BigQuery public datasets.

These first-party extensions provide some common tools for data analysis and insights. To build your own tools, see Use BigQuery with MCP, Gemini CLI, and other agents.

About Gemini CLI and extensions

The Gemini CLI is an open-source conversational AI agent from Google that accelerates development workflows and assists with coding, debugging, data exploration, and content creation. It offers an agent-driven experience to interact with Data Cloud services, such as BigQuery, and other popular Google Cloud databases and open-source databases.

For more information about the Gemini CLI, see the Gemini CLI documentation.

How extensions work

Extensions expand the capabilities of the Gemini CLI, letting it connect to and control specific Google Cloud services and other tools. The extensions provide Gemini with context and API understanding, enabling conversational interaction. You can load the extensions from GitHub URLs, local directories, or registries. These extensions offer tools, slash commands, and prompts. These are separate from IDE extensions, such as Gemini Code Assist, which integrate using the MCP Toolbox.

About the BigQuery extensions

BigQuery offers the following extensions to work with BigQuery data through the Gemini CLI:

BigQuery Data Analytics extension
Use this extension to discover data, learn more about BigQuery tables and datasets, and ask natural language questions about your datasets. You can also generate forecasts or run a contribution analysis using built-in advanced tools. The tools in this extension help the Gemini CLI write SQL queries based on your natural language questions, and then execute the queries to provide answers for your questions.
BigQuery Conversational Analytics extension
Use this extension to get advanced insights from your BigQuery data using a pre-hosted, server-side analytics agent. The tools in this extension help the Gemini CLI send your natural language question to a built-in, hosted agent and respond with deeper insights from your data.

BigQuery Data Analytics tools

The BigQuery Data Analytics extension provides the following tools:

Category Tool Example natural language prompt
Dataset and table information get_dataset_info Get information about the dataset bigquery-public-data.pypi
get_table_info Get information about the table bigquery-public-data.pypi.file_downloads
list_dataset_ids List all ML datasets in the project bigquery-public-data
list_table_ids List all tables in the dataset bigquery-public-data.pypi
Search search_catalog Find tables related to PyPi downloads
SQL execution execute_sql Using bigquery-public-data.pypi.file_downloads, show me the top 10 downloaded pypi packages this month
Time-series forecasting forecast Using bigquery-public-data.pypi.file_downloads, forecast the downloads for the last four months of 2025 for package urllib3
Contribution analysis analyze_contribution Analyze the contribution of country to revenue in the bigquery-public-data.google_analytics_sample.ga_sessions_20170801 table

Conversational Analytics tools

The Conversational Analytics extension provides the following tools:

Category Tool Example natural language prompt
Search search_catalog Find tables related to PyPi downloads
Conversational analytics ask_data_insights Using the tool ask_data_insights and the tables under bigquery-public-data.google_analytics_sample, tell me the channels I should focus on and why

Before you begin

Before you begin, you need the following:

Required roles

To get the permissions that you need to use the BigQuery extensions with Gemini CLI, ask your administrator to grant you the following IAM roles on Resource Manager resources (projects, folders, and organizations) or lower-level resources like datasets:

For more information about granting roles, see Manage access to projects, folders, and organizations.

You might also be able to get the required permissions through custom roles or other predefined roles.

Install the BigQuery extensions

Install the BigQuery extensions and then use them to explore and analyze your data.

  1. Install the Gemini CLI.

  2. Set the environment variables to connect to your BigQuery project:

    export BIGQUERY_PROJECT="PROJECT_ID"
    

    Replace PROJECT_ID with your Google Cloud project ID.

    You can also set these optional environment variables:

    • BIGQUERY_LOCATION: the dataset locationfor example: export BIGQUERY_LOCATION="us"
    • BIGQUERY_USE_CLIENT_OAUTH: whether to use client-side OAuthfor example: export BIGQUERY_USE_CLIENT_OAUTH=true
  3. Install the BigQuery Data Analytics or Conversational Analytics extension using the gemini extension install command:

    • Optional: install the BigQuery Data Analytics extension:

      gemini extensions install https://github.com/gemini-cli-extensions/bigquery-data-analytics
      
    • Optional: install the BigQuery Conversational Analytics extension:

      gemini extensions install https://github.com/gemini-cli-extensions/bigquery-conversational-analytics
      
  4. Start the Gemini CLI in interactive mode to explore and analyze your data:

    gemini
    

    The CLI automatically loads the BigQuery extension and its tools, which you can use to interact with your data.

Note: if you install both of the BigQuery extensions, the Gemini CLI might use tools from either extension to answer your questions. This could have a billing impact, as there is additional billing impact when using Conversational Analytics tools. For more information, see Pricing.

Example prompts to explore and analyze your data

Enter prompts in the Gemini CLI. You can use the following examples to get started.

Explore and analyze tables

The following example prompts let you explore and analyze your tables.

Run deeper insights using the ask_data_insights tool

The ask_data_insights tool triggers an agent on the BigQuery Conversational Analytics API to answer your questions. The server-side agent gathers additional context about your data and offers more insights.

Pricing

There is no additional cost for using metadata tools (such as get_dataset_info, get_table_info, list_dataset_ids, and list_table_ids) or the search_catalog tool.

Tools that run queries, including execute_sql, forecast, and analyze_contribution, are billed according to BigQuery on-demand pricing or BigQuery capacity pricing, depending on your project configuration.

During beta (pre-v1.0), the ask_data_insights tool is offered at no additional cost; however, any BigQuery queries that this tool triggers are billed according to standard BigQuery pricing.

What's next

Send feedback

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-12 UTC.

Need to tell us more? [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-12 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page