Monday 30 January 2017

google sdk- command line for big query

Welcome to the Google Cloud SDK! Run "gcloud -h" to get the list of available co
mmands.
---



Welcome to BigQuery! This script will walk you through the
process of initializing your .bigqueryrc configuration file.

First, we need to set up your credentials if they do not
already exist.


BigQuery configuration complete! Type "bq" to get started.

C:\Program Files (x86)\Google\Cloud SDK>bq ls
      datasetId
 --------------------
  trail_dataset_krvy

C:\Program Files (x86)\Google\Cloud SDK>bq ls trail_dataset_krvy
  tableId    Type
 ---------- -------
  test       TABLE
  testGcs1   TABLE

C:\Program Files (x86)\Google\Cloud SDK>bq mk cmdCreate
Dataset 'trail-project-1-vishnuyardini:cmdCreate' successfully created.

C:\Program Files (x86)\Google\Cloud SDK>bq ls
      datasetId
 --------------------
  cmdCreate
  trail_dataset_krvy

C:\Program Files (x86)\Google\Cloud SDK>bq load cmdCreate.cmdTable export.csv sn
o:string,content:string
BigQuery error in load operation: Source file not found: export.csv


C:\Program Files (x86)\Google\Cloud SDK>bq load cmdCreate.cmdTable export.csv sn
o:string,content:string
Upload complete.
Waiting on bqjob_r6d606f52_00000159ee65c15e_1 ... (1s) Current status: DONE

C:\Program Files (x86)\Google\Cloud SDK>bq ls cmdCreate
  tableId    Type
 ---------- -------
  cmdTable   TABLE

C:\Program Files (x86)\Google\Cloud SDK>bq show cmdCreate.cmdTable
Table trail-project-1-vishnuyardini:cmdCreate.cmdTable

   Last modified          Schema         Total Rows   Total Bytes   Expiration

 ----------------- -------------------- ------------ ------------- ------------

  30 Jan 13:32:54   |- sno: string       11           75

                    |- content: string



C:\Program Files (x86)\Google\Cloud SDK>bq query "select * from cmdCreate.cmdTab
le";
Waiting on bqjob_r321aacff_00000159ee753983_1 ... (0s) Current status: DONE
+-----+---------+
| sno | content |
+-----+---------+
| num | content |
| 1   | J       |
| 2   | I       |
| 3   | H       |
| 4   | G       |
| 5   | F       |
| 6   | E       |
| 7   | D       |
| 8   | C       |
| 9   | B       |
| 10  | A       |
+-----+---------+

No comments:

Post a Comment