What can you do with it?

Manage and analyze large datasets in Google Cloud BigQuery, including listing projects and datasets, querying tables, and executing SQL queries for data analysis and reporting.

How to use it?

Basic Command Structure

/your-bigquery-connection [action] [required-parameters] [optional-parameters]

Parameters

Required:

  • action - The operation to perform (list-projects, list-datasets, list-tables, run-query, get-query-results)

Optional:

  • project-id - Google Cloud project ID
  • dataset-id - BigQuery dataset ID
  • job-id - Query job ID for result retrieval

Tools

List Projects

Retrieve a list of projects to which the user has been granted any project role

Parameters:

  • No additional parameters required

Example:

/your-bigquery-connection
action: list-projects

Response:

{
  "kind": "bigquery#projectList",
  "projects": [
    {
      "kind": "bigquery#project",
      "id": "project-id-1",
      "numericId": "123456789",
      "projectReference": {
        "projectId": "project-id-1"
      },
      "friendlyName": "Project One"
    }
  ],
  "totalItems": 2
}

List Datasets

List all datasets in the specified project to which the user has been granted the READER dataset role

Parameters:

  • project-id (required) - The project ID containing the datasets

Example:

/your-bigquery-connection
action: list-datasets
project-id: project-id-1

Response:

{
  "kind": "bigquery#datasetList",
  "datasets": [
    {
      "kind": "bigquery#dataset",
      "id": "project-id-1:dataset_id_1",
      "datasetReference": {
        "datasetId": "dataset_id_1",
        "projectId": "project-id-1"
      },
      "location": "US"
    }
  ]
}

List Tables

Lists all tables in the specified dataset

Parameters:

  • project-id (required) - The project ID containing the dataset
  • dataset-id (required) - The dataset ID containing the tables

Example:

/your-bigquery-connection
action: list-tables
project-id: project-id-1
dataset-id: dataset_id_1

Response:

{
  "kind": "bigquery#tableList",
  "tables": [
    {
      "kind": "bigquery#table",
      "id": "project-id-1:dataset_id_1.table_id_1",
      "tableReference": {
        "projectId": "project-id-1",
        "datasetId": "dataset_id_1",
        "tableId": "table_id_1"
      },
      "type": "TABLE"
    }
  ],
  "totalItems": 2
}

Run Query

Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout

Parameters:

  • project-id (required) - The project ID to run the query in
  • query (required) - The SQL query to execute
  • use-legacy-sql (optional) - Whether to use legacy SQL syntax (default: false)

Example:

/your-bigquery-connection
action: run-query
project-id: project-id-1
query: SELECT name, age FROM `project-id-1.dataset_id_1.table_id_1` WHERE age > 30
use-legacy-sql: false

Response:

{
  "kind": "bigquery#queryResponse",
  "schema": {
    "fields": [
      {
        "name": "name",
        "type": "STRING"
      },
      {
        "name": "age",
        "type": "INTEGER"
      }
    ]
  },
  "jobReference": {
    "projectId": "project-id-1",
    "jobId": "job_12345"
  },
  "totalRows": "2",
  "rows": [
    {
      "f": [
        {
          "v": "Alice"
        },
        {
          "v": "35"
        }
      ]
    }
  ],
  "totalBytesProcessed": "1024",
  "jobComplete": true
}

Get Query Results

Retrieves the results of a query job

Parameters:

  • project-id (required) - The project ID containing the query job
  • job-id (required) - The query job ID

Example:

/your-bigquery-connection
action: get-query-results
project-id: project-id-1
job-id: job_12345

Response:

{
  "kind": "bigquery#queryResponse",
  "schema": {
    "fields": [
      {
        "name": "name",
        "type": "STRING"
      },
      {
        "name": "age",
        "type": "INTEGER"
      }
    ]
  },
  "jobReference": {
    "projectId": "project-id-1",
    "jobId": "job_12345"
  },
  "totalRows": "2",
  "rows": [
    {
      "f": [
        {
          "v": "Alice"
        },
        {
          "v": "35"
        }
      ]
    }
  ],
  "totalBytesProcessed": "1024",
  "jobComplete": true
}

Notes

BigQuery supports standard SQL syntax and provides detailed schema information for query results. Use backticks around fully qualified table names in the format project-id.dataset_id.table_id.