Google BigQuery

Learn how to use Google BigQuery with Composio

Overview

SLUG: GOOGLEBIGQUERY

Description

Google BigQuery is a fully managed data warehouse for large-scale data analytics, offering fast SQL queries and machine learning capabilities on massive datasets

Authentication Details

client_id
stringRequired
client_secret
stringRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to https://www.googleapis.com/auth/bigquery,https://www.googleapis.com/auth/userinfo.email
credentials_json
stringRequired

Connecting to Google BigQuery

Create an auth config

Use the dashboard to create an auth config for the Google BigQuery toolkit. This allows you to connect multiple Google BigQuery accounts to Composio for agents to use.

1

Select App

Navigate to [Google BigQuery](https://platform.composio.dev?next_page=/marketplace/Google BigQuery).

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Google BigQuery Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4googlebigquery_auth_config_id = "ac_YOUR_GOOGLEBIGQUERY_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Google BigQuery: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, googlebigquery_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Using Google Service Account

1# Template not found: templates/python/google_service_account.py

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the [Google BigQuery toolkit’s playground](https://app.composio.dev/app/Google BigQuery)

For code examples, see the Tool calling guide and Provider examples.

Tool List

Tool Name: Query

Description

Query Tool will run a SQL query in BigQuery. Note: Make sure the query being input in a single line format. For example, SELECT * FROM sample_dataset.sample_table WHERE column_name = 'value'

Action Parameters

destination_table
query
stringRequired
write_disposition

Action Response

data
objectRequired
error
successful
booleanRequired