Reputation: 7940
What is the syntax for creating table statement with struct fields? Below doesn't seem to work. I want to create a Record field such as id.level1.level2.level3
.
CREATE TABLE mayumi_load_test.struct_cre(
STRUCT<STRUCT<STRUCT<STRUCT<id INT64> level1> level2>level3,
t_ TIMESTAMP
)
PARTITION BY Date(t_)
Upvotes: 4
Views: 4735
Reputation: 173210
Below is for BigQuery Standard SQL
Create Table
#standardSQL
CREATE TABLE mayumi_load_test.struct_cre (
id STRUCT<level1 STRUCT<level2 STRUCT<level3 INT64>>>,
t_ TIMESTAMP
)
PARTITION BY DATE(t_)
Insert Data
#standardSQL
INSERT INTO mayumi_load_test.struct_cre(id, t_)
VALUES(
STRUCT(STRUCT(STRUCT(777))),
CURRENT_TIMESTAMP()
)
Upvotes: 6