Skip to content

Commit e4fb8b2

Browse files
authored
feat(bigquery): add Google BigQuery integration (#3341)
* feat(bigquery): add Google BigQuery integration * fix(bigquery): add auth provider, fix docsLink and insertedRows count * fix(bigquery): set pageToken visibility to user-or-llm for pagination * fix(bigquery): use prefixed export names to avoid aliased imports * lint * improvement(bigquery): destructure tool outputs with structured array/object types * lint
1 parent d98545d commit e4fb8b2

File tree

19 files changed

+1378
-0
lines changed

19 files changed

+1378
-0
lines changed

apps/docs/components/icons.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3430,6 +3430,23 @@ export const ResendIcon = (props: SVGProps<SVGSVGElement>) => (
34303430
</svg>
34313431
)
34323432

3433+
export const GoogleBigQueryIcon = (props: SVGProps<SVGSVGElement>) => (
3434+
<svg {...props} xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'>
3435+
<path
3436+
d='M14.48 58.196L.558 34.082c-.744-1.288-.744-2.876 0-4.164L14.48 5.805c.743-1.287 2.115-2.08 3.6-2.082h27.857c1.48.007 2.845.8 3.585 2.082l13.92 24.113c.744 1.288.744 2.876 0 4.164L49.52 58.196c-.743 1.287-2.115 2.08-3.6 2.082H18.07c-1.483-.005-2.85-.798-3.593-2.082z'
3437+
fill='#4386fa'
3438+
/>
3439+
<path
3440+
d='M40.697 24.235s3.87 9.283-1.406 14.545-14.883 1.894-14.883 1.894L43.95 60.27h1.984c1.486-.002 2.858-.796 3.6-2.082L58.75 42.23z'
3441+
opacity='.1'
3442+
/>
3443+
<path
3444+
d='M45.267 43.23L41 38.953a.67.67 0 0 0-.158-.12 11.63 11.63 0 1 0-2.032 2.037.67.67 0 0 0 .113.15l4.277 4.277a.67.67 0 0 0 .947 0l1.12-1.12a.67.67 0 0 0 0-.947zM31.64 40.464a8.75 8.75 0 1 1 8.749-8.749 8.75 8.75 0 0 1-8.749 8.749zm-5.593-9.216v3.616c.557.983 1.363 1.803 2.338 2.375v-6.013zm4.375-2.998v9.772a6.45 6.45 0 0 0 2.338 0V28.25zm6.764 6.606v-2.142H34.85v4.5a6.43 6.43 0 0 0 2.338-2.368z'
3445+
fill='#fff'
3446+
/>
3447+
</svg>
3448+
)
3449+
34333450
export const GoogleVaultIcon = (props: SVGProps<SVGSVGElement>) => (
34343451
<svg {...props} xmlns='http://www.w3.org/2000/svg' viewBox='0 0 82 82'>
34353452
<path

apps/docs/components/ui/icon-mapping.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {
4242
GitLabIcon,
4343
GmailIcon,
4444
GongIcon,
45+
GoogleBigQueryIcon,
4546
GoogleBooksIcon,
4647
GoogleCalendarIcon,
4748
GoogleDocsIcon,
@@ -188,6 +189,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
188189
gitlab: GitLabIcon,
189190
gmail_v2: GmailIcon,
190191
gong: GongIcon,
192+
google_bigquery: GoogleBigQueryIcon,
191193
google_books: GoogleBooksIcon,
192194
google_calendar_v2: GoogleCalendarIcon,
193195
google_docs: GoogleDocsIcon,
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
---
2+
title: Google BigQuery
3+
description: Query, list, and insert data in Google BigQuery
4+
---
5+
6+
import { BlockInfoCard } from "@/components/ui/block-info-card"
7+
8+
<BlockInfoCard
9+
type="google_bigquery"
10+
color="#E0E0E0"
11+
/>
12+
13+
## Usage Instructions
14+
15+
Connect to Google BigQuery to run SQL queries, list datasets and tables, get table metadata, and insert rows.
16+
17+
18+
19+
## Tools
20+
21+
### `google_bigquery_query`
22+
23+
Run a SQL query against Google BigQuery and return the results
24+
25+
#### Input
26+
27+
| Parameter | Type | Required | Description |
28+
| --------- | ---- | -------- | ----------- |
29+
| `projectId` | string | Yes | Google Cloud project ID |
30+
| `query` | string | Yes | SQL query to execute |
31+
| `useLegacySql` | boolean | No | Whether to use legacy SQL syntax \(default: false\) |
32+
| `maxResults` | number | No | Maximum number of rows to return |
33+
| `defaultDatasetId` | string | No | Default dataset for unqualified table names |
34+
| `location` | string | No | Processing location \(e.g., "US", "EU"\) |
35+
36+
#### Output
37+
38+
| Parameter | Type | Description |
39+
| --------- | ---- | ----------- |
40+
| `columns` | array | Array of column names from the query result |
41+
| `rows` | array | Array of row objects keyed by column name |
42+
| `totalRows` | string | Total number of rows in the complete result set |
43+
| `jobComplete` | boolean | Whether the query completed within the timeout |
44+
| `totalBytesProcessed` | string | Total bytes processed by the query |
45+
| `cacheHit` | boolean | Whether the query result was served from cache |
46+
| `jobReference` | object | Job reference \(useful when jobComplete is false\) |
47+
|`projectId` | string | Project ID containing the job |
48+
|`jobId` | string | Unique job identifier |
49+
|`location` | string | Geographic location of the job |
50+
| `pageToken` | string | Token for fetching additional result pages |
51+
52+
### `google_bigquery_list_datasets`
53+
54+
List all datasets in a Google BigQuery project
55+
56+
#### Input
57+
58+
| Parameter | Type | Required | Description |
59+
| --------- | ---- | -------- | ----------- |
60+
| `projectId` | string | Yes | Google Cloud project ID |
61+
| `maxResults` | number | No | Maximum number of datasets to return |
62+
| `pageToken` | string | No | Token for pagination |
63+
64+
#### Output
65+
66+
| Parameter | Type | Description |
67+
| --------- | ---- | ----------- |
68+
| `datasets` | array | Array of dataset objects |
69+
|`datasetId` | string | Unique dataset identifier |
70+
|`projectId` | string | Project ID containing this dataset |
71+
|`friendlyName` | string | Descriptive name for the dataset |
72+
|`location` | string | Geographic location where the data resides |
73+
| `nextPageToken` | string | Token for fetching next page of results |
74+
75+
### `google_bigquery_list_tables`
76+
77+
List all tables in a Google BigQuery dataset
78+
79+
#### Input
80+
81+
| Parameter | Type | Required | Description |
82+
| --------- | ---- | -------- | ----------- |
83+
| `projectId` | string | Yes | Google Cloud project ID |
84+
| `datasetId` | string | Yes | BigQuery dataset ID |
85+
| `maxResults` | number | No | Maximum number of tables to return |
86+
| `pageToken` | string | No | Token for pagination |
87+
88+
#### Output
89+
90+
| Parameter | Type | Description |
91+
| --------- | ---- | ----------- |
92+
| `tables` | array | Array of table objects |
93+
|`tableId` | string | Table identifier |
94+
|`datasetId` | string | Dataset ID containing this table |
95+
|`projectId` | string | Project ID containing this table |
96+
|`type` | string | Table type \(TABLE, VIEW, EXTERNAL, etc.\) |
97+
|`friendlyName` | string | User-friendly name for the table |
98+
|`creationTime` | string | Time when created, in milliseconds since epoch |
99+
| `totalItems` | number | Total number of tables in the dataset |
100+
| `nextPageToken` | string | Token for fetching next page of results |
101+
102+
### `google_bigquery_get_table`
103+
104+
Get metadata and schema for a Google BigQuery table
105+
106+
#### Input
107+
108+
| Parameter | Type | Required | Description |
109+
| --------- | ---- | -------- | ----------- |
110+
| `projectId` | string | Yes | Google Cloud project ID |
111+
| `datasetId` | string | Yes | BigQuery dataset ID |
112+
| `tableId` | string | Yes | BigQuery table ID |
113+
114+
#### Output
115+
116+
| Parameter | Type | Description |
117+
| --------- | ---- | ----------- |
118+
| `tableId` | string | Table ID |
119+
| `datasetId` | string | Dataset ID |
120+
| `projectId` | string | Project ID |
121+
| `type` | string | Table type \(TABLE, VIEW, SNAPSHOT, MATERIALIZED_VIEW, EXTERNAL\) |
122+
| `description` | string | Table description |
123+
| `numRows` | string | Total number of rows |
124+
| `numBytes` | string | Total size in bytes, excluding data in streaming buffer |
125+
| `schema` | array | Array of column definitions |
126+
|`name` | string | Column name |
127+
|`type` | string | Data type \(STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP, RECORD, etc.\) |
128+
|`mode` | string | Column mode \(NULLABLE, REQUIRED, or REPEATED\) |
129+
|`description` | string | Column description |
130+
| `creationTime` | string | Table creation time \(milliseconds since epoch\) |
131+
| `lastModifiedTime` | string | Last modification time \(milliseconds since epoch\) |
132+
| `location` | string | Geographic location where the table resides |
133+
134+
### `google_bigquery_insert_rows`
135+
136+
Insert rows into a Google BigQuery table using streaming insert
137+
138+
#### Input
139+
140+
| Parameter | Type | Required | Description |
141+
| --------- | ---- | -------- | ----------- |
142+
| `projectId` | string | Yes | Google Cloud project ID |
143+
| `datasetId` | string | Yes | BigQuery dataset ID |
144+
| `tableId` | string | Yes | BigQuery table ID |
145+
| `rows` | string | Yes | JSON array of row objects to insert |
146+
| `skipInvalidRows` | boolean | No | Whether to insert valid rows even if some are invalid |
147+
| `ignoreUnknownValues` | boolean | No | Whether to ignore columns not in the table schema |
148+
149+
#### Output
150+
151+
| Parameter | Type | Description |
152+
| --------- | ---- | ----------- |
153+
| `insertedRows` | number | Number of rows successfully inserted |
154+
| `errors` | array | Array of per-row insertion errors \(empty if all succeeded\) |
155+
|`index` | number | Zero-based index of the row that failed |
156+
|`errors` | array | Error details for this row |
157+
|`reason` | string | Short error code summarizing the error |
158+
|`location` | string | Where the error occurred |
159+
|`message` | string | Human-readable error description |
160+
161+

apps/docs/content/docs/en/tools/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"gitlab",
3838
"gmail",
3939
"gong",
40+
"google_bigquery",
4041
"google_books",
4142
"google_calendar",
4243
"google_docs",

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const SCOPE_DESCRIPTIONS: Record<string, string> = {
4444
'https://www.googleapis.com/auth/userinfo.profile': 'View basic profile info',
4545
'https://www.googleapis.com/auth/forms.body': 'View and manage Google Forms',
4646
'https://www.googleapis.com/auth/forms.responses.readonly': 'View responses to Google Forms',
47+
'https://www.googleapis.com/auth/bigquery': 'View and manage data in Google BigQuery',
4748
'https://www.googleapis.com/auth/ediscovery': 'Access Google Vault for eDiscovery',
4849
'https://www.googleapis.com/auth/devstorage.read_only': 'Read files from Google Cloud Storage',
4950
'https://www.googleapis.com/auth/admin.directory.group': 'Manage Google Workspace groups',

0 commit comments

Comments
 (0)