BigQuery

The BigQuery node runs SQL queries and inserts rows into Google BigQuery datasets via the BigQuery REST API v2.

The BigQuery node runs SQL queries and inserts rows into Google BigQuery datasets via the BigQuery REST API v2. Use it to query large analytical datasets or stream rows into tables from workflow data.

Overview

PropertyValue
Inputs1
Outputs1
CredentialBigQuery (OAuth2)
Output$nodeLabel.rows, $nodeLabel.total, $nodeLabel.schema, $nodeLabel.insertedCount, $nodeLabel.errors

Parameters

ParameterTypeDescription
credentialIdUUIDBigQuery credential from Credentials
bqOperationstringOperation: query or insertRows
bqProjectIdexpressionGoogle Cloud project ID (e.g. my-gcp-project)
bqQueryexpressionSQL query string. Required for query.
bqMaxResultsstringMax rows returned by query (default 1000).
bqDatasetIdexpressionDataset ID (e.g. my_dataset). Required for insertRows.
bqTableIdexpressionTable ID (e.g. my_table). Required for insertRows.
bqRowsInputModeraw | selectiveFor insertRows: Raw = full JSON array; Selective = single row as key-value field pairs.
bqRowsexpressionJSON array of row objects for raw mode (e.g. [{"col": "$input.value"}]).
bqMappingsarrayKey-value pairs for selective mode. Each key is a column name; each value is an expression.

Credential Setup

BigQuery uses an OAuth2 "Bring Your Own App" model. You provide your own Google Cloud OAuth2 credentials.

Backend configuration: Set FRONTEND_URL on the Heym backend to the public URL of the app (the address users type in the browser), e.g. https://your-heym-domain. The OAuth redirect URI is always {FRONTEND_URL}/api/credentials/bigquery/oauth/callback.

  1. Go to Google Cloud ConsoleAPIs & ServicesEnable APIs → enable BigQuery API.
  2. Go to CredentialsCreate CredentialsOAuth client ID → select Web application.
  3. Under Authorized redirect URIs, add exactly: {your FRONTEND_URL}/api/credentials/bigquery/oauth/callback.
  4. Copy the Client ID and Client Secret.
  5. In Heym Dashboard → CredentialsNew → select BigQuery (OAuth2).
  6. Enter the Client ID, Client Secret, and a name, then click Connect to complete the OAuth2 consent in a browser popup.

Tokens refresh automatically in the background — no manual token management required.

Operations

OperationRequired FieldsDescription
querybqProjectId, bqQueryRun a SQL query and return rows
insertRowsbqProjectId, bqDatasetId, bqTableId, bqRows or bqMappingsInsert one or more rows via the streaming insertAll API

Output Reference

OperationOutput fieldTypeDescription
query.rowsarrayArray of row objects (column name → value)
query.totalnumberNumber of rows returned
query.schemaarrayTable schema fields
insertRows.insertedCountnumberNumber of rows successfully inserted
insertRows.errorsarrayInsertion errors per row (empty on full success)

Example – Run a Query

{
  "type": "bigquery",
  "data": {
    "label": "getUsers",
    "credentialId": "bigquery-credential-uuid",
    "bqOperation": "query",
    "bqProjectId": "my-gcp-project",
    "bqQuery": "SELECT id, name, email FROM `my_dataset.users` WHERE active = TRUE LIMIT 100",
    "bqMaxResults": "100"
  }
}

Access output: $getUsers.rows (array of row objects), $getUsers.rows[0].email, $getUsers.total.

Example – Insert a Row

{
  "type": "bigquery",
  "data": {
    "label": "logEvent",
    "credentialId": "bigquery-credential-uuid",
    "bqOperation": "insertRows",
    "bqProjectId": "my-gcp-project",
    "bqDatasetId": "analytics",
    "bqTableId": "events",
    "bqRowsInputMode": "selective",
    "bqMappings": [
      { "key": "event_name", "value": "$input.eventName" },
      { "key": "user_id", "value": "$input.userId" },
      { "key": "timestamp", "value": "$input.timestamp" }
    ]
  }
}