在Google Bigquery中创建表SQL语法 [英] Create table SQL syntax in Google Bigquery

查看:510
本文介绍了在Google Bigquery中创建表SQL语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从深夜开始,我一直在阅读 bigquery文档,非常理解很少.它讨论了通过不同方法加载数据的问题,但没有说明如何创建要将数据加载到的表.当我使用Web UI时,希望我键入架构.我的桌子有400列以上.我不会键入数百个列名,类型和长度.

I've been reading the bigquery documentation since late last night and understand very little of it. It talks about loading data via different methods, but doesn't say how to create the table that I'm going to load data into. When I use the web UI it expects me to type out the schema. My table has over 400 columns. I will not type out hundreds of column names, types and lengths.

我一直在将数百GB的csv格式的数据上传到Google存储桶. csv文件没有列名.我有喜欢使用的sql格式的架构.

I've been uploading hundreds of GB of data in csv format to a google bucket. The csv files do not have column names. I have the schema in sql format which I prefer to use.

如果我尝试通过查询创建表,则在第2行上已经收到一条错误消息,

If I try creating a table through a query I get an error already on line 2 that says,

"Error: Encountered "" at line 2, column 1."

CREATE TABLE [example-mdi:myData_1.ST] (
`ADDRESS_ID` varchar(9),
`INDIVIDUAL_ID` varchar(2),
`FIRST_NAME` varchar(25),
`LAST_NAME` varchar(2),...

我该怎么办?或者正确的方法是什么?

How can I do this or what is the right way?

推荐答案

在Web UI中创建表时-您可以按字段输入模式字段(Edit as Fields模式-默认模式),也可以将模式输入为文本( Edit as Text模式)
因此,如果您已经拥有sql格式的架构,则可以使用它(您可能需要稍作调整以符合BigQuery的要求)

When you create table in Web UI - you can enter schema field by field (Edit as Fields mode - default mode) or you can enter schema as a text (Edit as Text mode)
So, if you already have your schema in sql format you can just use it (you will might need to slightly adjust it to conform with BigQuery)

详细了解用不同的客户端创建表(在我们的bUI"部分中未显示该选项,所以我认为这就是为什么您错过它的原因)

See more about creating tables with different clients (in We bUI section above option is not presented, so that's why you missed it I think)

P.S.截止到今天,BigQuery不支持DDL-因此CREATE TABLE不可用

P.S. As of today, BigQuery doe not support DDL - so CREATE TABLE is not available

更新

截至今天-2018年1月17日-BigQuery data definition language 现在位于 Beta

As of today - Jan 17, 2018 - BigQuery data definition language support is now in Beta

这篇关于在Google Bigquery中创建表SQL语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆