How can one view the create table DDL for a bigquery table?

风格不统一 提交于 2019-12-11 17:54:53

问题


I'm trying to use the Web UI to extract a create table statement, so that I can see how one might create a nullable repeated column (if possible).

I've managed to make something like that using a query is some context. It created a record column with a mode repeated, which within it had a record column with a mode of nullable. Not sure if that's necessary, and, in any event, I'd like to see how one would go about doing that.


回答1:


how one might create a nullable repeated column (if possible)?

below is example of schema to use

[
  {
    "name": "myCol",
    "type": "RECORD",
    "mode": "REPEATED",
    "fields": [
      {
        "name": "myNestedCol",
        "type": "STRING",
        "mode": "NULLABLE"
      }
    ]
  }
]

Same with DDL:

#standardSQL
CREATE TABLE `project.dataset.table`
(
 myCol ARRAY<STRUCT<myNestedCol STRING>>
)


来源:https://stackoverflow.com/questions/51850435/how-can-one-view-the-create-table-ddl-for-a-bigquery-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!