|
| 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 | + |
0 commit comments