Friday, 20 June 2025

Viewing Dataset Details in BigQuery Using the bq Command-Line Tool

If you're working with BigQuery from the command line, the bq show command is a quick and easy way to view dataset details.

syntax 

bq show --dataset my_dataset

Example

bq show --dataset test_dataset

What this command does?

·      bq: This is the command-line tool for interacting with BigQuery.

·      show: Tells BigQuery to display information about a resource.

·      --dataset: Specifies that the resource is a dataset, not a table or job.

·      test_dataset: The name of the dataset you want to inspect.

$bq show --dataset test_dataset
Dataset demo-project:test_dataset

   Last modified                  ACLs                  Labels    Type     Max time travel (Hours)  
 ----------------- ----------------------------------- -------- --------- ------------------------- 
  06 Apr 18:52:03   Owners:                                      DEFAULT   168                      
                      test@test.com,                                               
                      projectOwners                                                                 
                    Writers:                                                                        
                      projectWriters                                                                
                    Readers:                                                                        
                      projectReaders                                                                

Dataset demo-project:test_dataset

This line tells you the fully qualified name of the dataset, which includes:

·      Project ID: demo-project

·      Dataset name: test_dataset

 

Detailed Output Table:

Column

Meaning

Last modified

The last time this dataset was updated. Useful to track activity.

ACLs

(Access Control List) Lists who has access to the dataset and their roles:

- Owners: Can manage access, delete the dataset, etc.

- Writers: Can create/update tables inside the dataset.

- Readers: Can only view the contents (no edits).

Example:

- test@test.com: a user with owner access

- projectOwners, projectWriters, projectReaders: Google Cloud default roles for the project

Labels

Key-value tags used for organizing datasets (e.g., billing, teams). This one is empty, meaning no labels were added yet.

Type

Always shows DEFAULT for standard datasets.

Max time travel (Hours)

Number of hours you can query back in time for table data changes. BigQuery’s default is 168 hours (7 days).

 

Why is this info useful?

·      To audit access: see who can read/write/manage your dataset.

·      To track changes: know when a dataset was last modified.

·      To manage costs and organization using labels and time travel settings.

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment