简体   繁体   中英

Create Table in Big Query

I have a csv file and I am trying to create a table in BQ.

But every time I click "Auto Detect" (Schema) and "Create Table" it makes both columns into integer. I want one column as string and one column as integer.

For example it gives me the result as (Both Columns are integer):

在此处输入图像描述

But I want the result as (String): Even though I have saved the xls as this when I save the file as csv it eliminated the zeros infront.

在此处输入图像描述

Thanks

From the BigQuery document

When auto-detection is enabled, BigQuery starts the inference process by selecting a random file in the data source and scanning up to 100 rows of data to use as a representative sample. BigQuery then examines each field and attempts to assign a data type to that field based on the values in the sample.

BigQuery purely uses the value to infer the schema, so the best solution for the problem is passing the schema explicitly.

https://cloud.google.com/bigquery/docs/schema-detect

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM