Scott Wood
Scott Wood

Reputation: 1127

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

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.

Upvotes: 1

Views: 1622

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 172944

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

Upvotes: 1

Related Questions