简体   繁体   English

在大查询中创建表

[英]Create Table in Big Query

I have a csv file and I am trying to create a table in BQ.我有一个 csv 文件,我正在尝试在 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.但是每次我单击“自动检测”(模式)和“创建表”时,它都会将两列都变成 integer。我想要一列作为字符串,一列作为 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.但我希望结果为(字符串):即使我在将文件另存为 csv 时将 xls 保存为这样,它也消除了前面的零。

在此处输入图像描述

Thanks谢谢

From the BigQuery document来自 BigQuery 文档

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 通过在数据源中选择一个随机文件并扫描最多 100 行数据以用作代表性样本来启动推理过程。 BigQuery then examines each field and attempts to assign a data type to that field based on the values in the sample.然后,BigQuery 检查每个字段并尝试根据示例中的值将数据类型分配给该字段。

BigQuery purely uses the value to infer the schema, so the best solution for the problem is passing the schema explicitly. BigQuery 纯粹使用值来推断架构,因此解决该问题的最佳方法是显式传递架构。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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