Forrest logo
back to the bq tool

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 machine

This command is using the bq command line tool to list BigQuery resources based on certain criteria, and it has the following components:

  • bq ls: This is the main command to list resources in BigQuery.

  • --filter labels.${key}:${value}: This flag filters the resources based on a label key-value pair. Labels are user-defined metadata that can be assigned to BigQuery resources. The command will only return resources that have a label with the specified key-value pair.

  • --max_results ${integer}: This flag sets the maximum number of results to be returned. You can replace ${integer} with the desired number.

  • --format=prettyjson: This flag specifies the format in which the output information should be displayed. In this case, it is set to prettyjson, which formats the output in a human-readable JSON format.

  • --project_id ${project_id}: This flag specifies the ID of the Google Cloud project in which you want to list the BigQuery resources. Replace ${project_id} with the actual project ID.

Overall, this command is used to list BigQuery resources that match the provided filter criteria, within the specified project, with a limit on the maximum number of results returned. The output will be displayed in a pretty JSON format.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the bq tool