Skip to main content
The BigQueryResourceClient allows you to execute SQL queries against Google BigQuery datasets, explore schemas, and retrieve table metadata.

Usage

import { myBigQueryClient } from "./clients";

const result = await myBigQueryClient.invoke(
  "SELECT * FROM `my_dataset.users` WHERE active = true LIMIT 100",
  [],
  "fetch-active-users"
);

if (result.ok) {
  console.log(result.result.rows);
}

Inputs

The invoke method accepts the following arguments:
sql
string
required
The SQL query string to execute.
params
(string | number | boolean | null)[]
An array of values for parameterized queries.
invocationKey
string
required
A unique identifier for this operation, used for tracing and logging.
timeoutMs
number
Optional timeout in milliseconds for the query execution.

Outputs

On success (ok: true), the result object contains:
kind
"database"
Discriminator for the response type.
rows
Record<string, unknown>[]
An array of objects representing the rows returned by the query.
rowsAffected
number
The number of rows affected by the query.