GENERATE COLUMNS
Syntax
GENERATE COLUMNS
FOR entity_name
[ IN STORE store_name ];
Description
This command generates a list of DDL columns from an entity — for example, Data Store — that has corresponding Protocol Buffers and Descriptors. The command specially simplifies creating DDL for complex descriptors.
You can generate entity columns only if the current role has USAGE
privileges on the Data Store.
Arguments
entity_name
Name of the entity for which to generate columns.
IN STORE store_name
Optionally, you can provide a store_name
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