Devi
Devi

Reputation: 35

Native Table creation on top of GCS failed in Bigquery

I tried to create a Big query native table on top of GCS bucket. The native table creation works, when the table is created from the UI, But when I tried to run DDL for creating a native table on top of GCS it Failed

Below is the query used and error produced:

create table sample_ds_001.native options ( format='csv' ,uris=["gs://test-bucket-003/File_Folder/sample.txt"] )

Error: Unknown option: format at [4:3]

Upvotes: 0

Views: 379

Answers (1)

Prajna Rai T
Prajna Rai T

Reputation: 1810

You can create an external table for your requirement using the csv file stored in the gcs bucket, below query can be considered:

Create EXTERNAL table `project-id.dataset.table` 
options (format='csv' ,uris=["gs://file-location.csv"])

CSV Data:

A,B,C,D,E,F,G
47803,000000000020030263,629,785,2021-01-12 23:26:37,986,2022-01-12 23:26:37

Output:

enter image description here

Upvotes: 1

Related Questions