How can one view the create table DDL for a bigque

2019-08-22 10:24发布

问题:

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>>
)