GENERATE COLUMNS

Syntax

GENERATE COLUMNS
FOR entity_name
[ IN STORE store_name ];

Description

This command generates a list of DDL columns from an entity, e.g. Entity, that has corresponding Protocol Buffers and Descriptors. The command specially simplifies creating DDL for complex Descriptors.

Entity columns can only be generated if the current role has USAGE privileges on the Store.

Arguments

entity_name

Name of the entity to generate columns for.

IN STORE store_name

Optionally, a store_name can be provided to search the corresponding entity_name within.

Examples

Generate columns for an Entity in the current Store

demodb.public/demostore# GENERATE COLUMNS FOR pageviews_pb;
+------------------------------------------+
|  Template                                |
+==========================================+
| viewtime BIGINT NOT NULL, userid         |
| VARCHAR NOT NULL, pageid VARCHAR NOT     |
| NULL                                     |
+------------------------------------------+

Generate columns for an Entity in a specific Store

demodb.public/demostore# GENERATE COLUMNS FOR employee IN STORE company;
+-------------------------------------------+
|  Template                                 |
+===========================================+
| id BIGINT NOT NULL, pager_id BIGINT NOT   |
| NULL, laptop_id BIGINT NOT NULL, badge_id |
| BIGINT NOT NULL, insurance_id BIGINT NOT  |
| NULL, office_number INTEGER NOT NULL,     |
| salary INTEGER NOT NULL, age INTEGER NOT  |
| NULL, device_number INTEGER NOT NULL,     |
| desk_number INTEGER NOT NULL, full_time   |
| BOOLEAN NOT NULL, bonus_rate DOUBLE NOT   |
| NULL, increase_rate FLOAT NOT NULL, name  |
| VARCHAR NOT NULL, department BYTES NOT    |
| NULL, projects ARRAY<VARCHAR>, contacts   |
| MAP<VARCHAR, BIGINT>, home_address        |
| STRUCT<unit INTEGER, street VARCHAR,      |
| city VARCHAR, state VARCHAR>, managers    |
| ARRAY<STRUCT<name VARCHAR, title VARCHAR, |
| team STRUCT<id BIGINT, leaders            |
| ARRAY<VARCHAR>, artifacts ARRAY<STRUCT<id |
| BIGINT, name VARCHAR>>>>>, leaders        |
| MAP<VARCHAR, STRUCT<name VARCHAR, title   |
| VARCHAR, team STRUCT<id BIGINT, leaders   |
| ARRAY<VARCHAR>, artifacts ARRAY<STRUCT<id |
| BIGINT, name VARCHAR>>>>>                 |
+-------------------------------------------+

Last updated