Creating the table definition

Download the sample file from this URL and upload it to a Google Cloud Storage bucket: https://github.com/hthirukkumaran/Learning-Google-BigQuery/blob/master/chapter1/employeedetails.csv.

To create a table definition file, run the following command. Replace the bucket name and filename as per your project. The following command detects the schema of the table from the file:

bq mkdef --autodetect --source_format=CSV "gs://myfirstprojectbucket201706/employeedetails.csv" >  tabledefinition.txt

The preceding command outputs a JSON format file. The file will look like the one shown in the following screenshot. Once this file is generated, we can use it to query the data in the CSV file defined in this file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.171.212