Setu Recipes: reusable digital workers across every app.Browse templates

Integrations / Google BigQuery

Google BigQuery

Run SQL on Google BigQuery and browse datasets and tables. Queries use standard SQL and can change data if the SQL does.

5 actions OAuth 2 4 read1 write Calls bigquery.googleapis.com

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "bigquery" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

ScopeWhy it is requested
https://www.googleapis.com/auth/userinfo.emailSee which Google account you connected
https://www.googleapis.com/auth/bigqueryView and manage your data in Google BigQuery and run queries

Actions

Get query resultsreadbigquery.get_query_resultsFetch the results of a BigQuery query job by job ID, one page at a time. Use after run_query returns an unfinished job or a page token.

Needs scope: https://www.googleapis.com/auth/bigquery

InputTypeDescription
project_idstringRequiredProject ID of the query job
job_idstringRequiredJob ID from run_query
locationstringOptionalJob location, e.g. US
max_resultsintegerOptionalRows per page
page_tokenstringOptionalToken from a previous page
timeout_msintegerOptionalHow long to wait for the job to finish
TypeScript
await setu.execute({
  userId: "user_1",
  action: "bigquery.get_query_results",
  input: {
    "project_id": "<project_id>",
    "job_id": "<job_id>"
  },
});
Get tablereadbigquery.get_tableGet a table's schema (column names and types), row count and size.

Needs scope: https://www.googleapis.com/auth/bigquery

InputTypeDescription
project_idstringRequiredGoogle Cloud project ID
dataset_idstringRequiredDataset ID
table_idstringRequiredTable ID
TypeScript
await setu.execute({
  userId: "user_1",
  action: "bigquery.get_table",
  input: {
    "project_id": "<project_id>",
    "dataset_id": "<dataset_id>",
    "table_id": "<table_id>"
  },
});
List datasetsreadbigquery.list_datasetsList the datasets in a Google Cloud project.

Needs scope: https://www.googleapis.com/auth/bigquery

InputTypeDescription
project_idstringRequiredGoogle Cloud project ID
max_resultsintegerOptionalMaximum datasets to return
page_tokenstringOptionalToken from a previous page
TypeScript
await setu.execute({
  userId: "user_1",
  action: "bigquery.list_datasets",
  input: {
    "project_id": "<project_id>"
  },
});
List tablesreadbigquery.list_tablesList the tables and views in a BigQuery dataset.

Needs scope: https://www.googleapis.com/auth/bigquery

InputTypeDescription
project_idstringRequiredGoogle Cloud project ID
dataset_idstringRequiredDataset ID
max_resultsintegerOptionalMaximum tables to return
page_tokenstringOptionalToken from a previous page
TypeScript
await setu.execute({
  userId: "user_1",
  action: "bigquery.list_tables",
  input: {
    "project_id": "<project_id>",
    "dataset_id": "<dataset_id>"
  },
});
Run querywritebigquery.run_queryRun a standard SQL query in BigQuery (jobs.query) and return the first page of rows, or a job ID to poll with get_query_results if it is not finished. SQL can modify data and incurs query cost.

Needs scope: https://www.googleapis.com/auth/bigquery

InputTypeDescription
project_idstringRequiredGoogle Cloud project ID that runs and is billed for the query
querystringRequiredStandard SQL to run
max_resultsintegerOptionalRows per page
timeout_msintegerOptionalHow long to wait for completion before returning a job reference
locationstringOptionalJob location, e.g. US or EU
dry_runbooleanOptionalOnly validate the query and estimate bytes processed
TypeScript
await setu.execute({
  userId: "user_1",
  action: "bigquery.run_query",
  input: {
    "project_id": "<project_id>",
    "query": "<query>"
  },
});