![Forrest logo](/images/logo.png)
On this page you find all important commands for the CLI tool bq. If the
command you are looking for is missing please ask our AI.
bq
Bq is a command-line tool provided by Google Cloud Platform's BigQuery service. It stands for BigQuery and allows users to interact with BigQuery data and manage their resources from the command line interface.
Some key functionalities of bq include:
- Querying and analyzing data: bq allows users to run SQL-like queries on datasets stored in BigQuery. It supports query execution, result retrieval, and data import/export operations.
- Managing datasets and tables: Users can create, delete, list, and update datasets and tables through bq. This includes setting access controls, schemas, and other configurations.
- Data manipulation: With bq, users can load data into BigQuery from various file formats such as CSV, JSON, Parquet, etc. Additionally, they can extract data from BigQuery tables into files stored in Google Cloud Storage.
- Data exploration: bq provides functions to preview table data, describe tables and their schemas, display query history, and retrieve job information.
- Controlling access: Using bq, administrators can manage access permissions for datasets, tables, and jobs, controlling who can view, edit, or query the data.
Overall, bq enables users to interact with BigQuery services conveniently and perform diverse data management and analysis tasks from the command line interface, making it a useful tool for developers, data scientists, and administrators working with BigQuery on Google Cloud Platform.
List of commands for bq:
-
bq:tldr:192e6 bq: Batch load data from a specific file in formats such as CSV, JSON, Parquet, and Avro to a table.$ bq load --location=${location} --source_format=${select} ${dataset}.${table} ${path_to_source}try on your machineexplain this command
-
bq:tldr:1feb7 bq: Create a new dataset or table in the US location.$ bq mk --location=US ${dataset_name}.${table_name}try on your machineexplain this command
-
bq:tldr:433c6 bq: Copy one table to another.$ bq cp ${dataset}.${OLD_TABLE} ${dataset}.${new_table}try on your machineexplain this command
-
bq:tldr:6ee1c bq: List all datasets in a project.$ bq ls --filter labels.${key}:${value} --max_results ${integer} --format=prettyjson --project_id ${project_id}try on your machineexplain this command
-
bq:tldr:ddf5a bq: Run a parameterized query.$ bq query --use_legacy_sql=false --parameter='ts_value:TIMESTAMP:2016-12-07 08:00:00' 'SELECT TIMESTAMP_ADD(@ts_value, INTERVAL 1 HOUR)'try on your machineexplain this command
-
bq:tldr:ea5a3 bq: Run query against a BigQuery table using standard SQL, add `--dry_run` flag to estimate the number of bytes read by the query.$ bq query --nouse_legacy_sql 'SELECT COUNT(*) FROM ${DATASET_NAME}.${TABLE_NAME}'try on your machineexplain this command