'Google cloud "mk" error "Invalid identifier 'ch04' for mk."

I am very new to google cloud and following an example in "Google BigQuery: The Definitive Guide" to learn to use this platform. I am trying to make a dataset to hold the data of a dataset and exactly typing what it is written in the book but I get the following results: Invalid identifier 'ch04' for mk.

here is a picture of the command lines Click here

Can you help me with this problem? Thanks



Solution 1:[1]

To create a dataset from the command line you need to run a bq mk command.

Look at this official documentation as it should provide all the necessary details on how to create a dataset. To sum up you need to follow this syntax

bq --location=<location> mk \
--dataset \
--default_table_expiration <integer1> \
--default_partition_expiration <integer2> \
--description <description> \
project_id:<dataset-name>

For example:

bq --location=US mk -d \
--default_table_expiration 3600 \
--description "This is my first dataset." \
myfirstdataset

I assume that ch04 may stand for information in chapter 4 or some other in-book notation that needs to be changed accordingly to make the command work.

Solution 2:[2]

I opened Cloud Shell from Google Cloud Plataform, at the right from the TERMINAL tab there's a tab with your Project Name that open a Terminal too. I typed the commands there and worked fine !

Solution 3:[3]

In the cloud shell, See if your project is set using below command.

gcloud config list project

If it is not set, set the project id using below command

gcloud config set project <projectid>

then run the command

bq --location=US mk ch04

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 aemon4
Solution 2 sonia perez
Solution 3 Kuro Neko