bigquery

Run BigQuery SQL queries and export results using the bq CLI.

16|Updated Aug 29, 2025
One-click install
npx skills add https://github.com/sourcegraph/amp-contrib --skill bigquery
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bigquery
Source: https://github.com/sourcegraph/amp-contrib/tree/main/bigquery
Command: npx skills add https://github.com/sourcegraph/amp-contrib --skill bigquery

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables you to query Google BigQuery using the bq command-line tool to run SQL queries, explore datasets, and export results, saving you time on data analysis.

Core Features & Use Cases

  • Querying: Run standard SQL queries against datasets using the bq CLI.
  • Discovery & Export: List datasets, inspect table schemas, and export results to CSV or JSON.
  • Use Case: Quickly fetch the first 10 rows of a production table and export to JSON for downstream analysis.

Quick Start

Use the bq CLI to run a sample query against your project, for example: bq query --use_legacy_sql=false 'SELECT * FROM project.dataset.table LIMIT 10'

Frequently Asked Questions about bigquery

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run SQL queries against BigQuery from the command line?

Use the bq CLI tool to execute SQL queries directly from your terminal. Run `bq query --use_legacy_sql=false 'SELECT * FROM `project.dataset.table`'` to retrieve data from BigQuery datasets without leaving the CLI, supporting standard SQL syntax and project-scoped table references.

Can I export BigQuery query results to CSV or JSON?

Yes, the bq CLI supports exporting query results to multiple formats including CSV and JSON. Specify a destination table or use export flags to write results directly to files, enabling downstream analysis and integration with other data processing tools.

How do I explore BigQuery datasets and table schemas from the CLI?

The bq CLI lets you list datasets, inspect table schemas, and preview data structures without opening the web console. Use commands to show dataset contents and schema details, streamlining discovery of available tables and columns across your BigQuery projects.

Does the bq CLI support cost estimation before running queries?

Yes, use the dry-run feature in bq to estimate query costs before execution. The tool calculates bytes scanned without actually running the query, helping you optimize queries and control BigQuery spending across shared datasets and large projects.

Can I query across multiple BigQuery projects using the CLI?

The bq CLI supports precise project-scoped table references using backtick notation (`project.dataset.table`), allowing you to query tables across different BigQuery projects and shared datasets from a single command without switching contexts.