Rajalakshmi
Rajalakshmi

Reputation: 771

create partitioned table from JSON file in BigQuery

I would like to create a partitioned table in BigQuery. The schema for the table is in JSON format stored in my local path.

I would like to create this table with partition from the JSON file using "bq mk -t" command. Kindly help.

Thanks in advance.

Upvotes: 0

Views: 1473

Answers (2)

Nature Labs
Nature Labs

Reputation: 11

One recommendation to use the JSON format for creating the bigquery tables. (1) If we decide to use the partition the table for better performance use the pseudo partition (_PARTITIONTIME or _PARTITITIONDATE). (2) Example, partition_date is the column which has the data type of TIMESTAMP (we can use data type column DATE also).

     {
    
      "name": "partition_date",
      "type": "TIMESTAMP",
      "mode": "NULLABLE",
      "timePartitioning": {
      "type": "DAY"
      },
      "field" : [
           {
            "name": "partition_date",
            "type": "TIMESTAMP"
           } 
            
        ]

    },

Upvotes: 0

Nature Labs
Nature Labs

Reputation: 11

bk mk  --table --schema=file.json  PROJECTID:DATASET.TABLE

Hope the above example helps.

you can refer to the more options.

Upvotes: 0

Related Questions