← 返回命令列表

Linux command

bq 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Query

bq query ["SELECT * FROM dataset.table LIMIT 10"]

List

bq ls

Show

bq show [dataset.table]

Load

bq load --source_format=CSV [dataset.table] [data.csv] [schema.json]

Extract

bq extract [dataset.table] gs://[bucket/file.csv]

说明

bq is the command-line interface for Google BigQuery. It enables querying massive datasets, managing tables and datasets, loading data, and controlling access through a unified interface. The tool provides programmatic access to BigQuery's data warehouse capabilities.

参数

--project_id _id_
Project ID
--dataset_id _id_
Dataset ID
--format _format_
Output format (json, csv, prettyjson)
--max_rows _n_
Maximum rows to return
--use_legacy_sql=false
Use standard SQL (recommended)

FAQ

What is the bq command used for?

bq is the command-line interface for Google BigQuery. It enables querying massive datasets, managing tables and datasets, loading data, and controlling access through a unified interface. The tool provides programmatic access to BigQuery's data warehouse capabilities.

How do I run a basic bq example?

Run `bq query ["SELECT * FROM dataset.table LIMIT 10"]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --project_id _id_ do in bq?

Project ID