TABLE
Config path: /<database>/<schema>/table/<name>.yaml
Example:
Schema
columns (dict)
{key} (ident) - column name
{value} (dict)
default (str) - default SQL expression
default_sequence (ident) - sequence used for "auto increment"
comment (str)
is_transient (bool) - make table TRANSIENT
retention_time (int) - data retention time in days
cluster_by (list)
{items} (str) - SQL expressions for CLUSTER BY
change_tracking (bool) - enable CHANGE TRACKING
search_optimization (bool) - enable SEARCH OPTIMIZATION on the whole table --- OR ---
search_optimization (dict) - enable SEARCH OPTIMIZATION on specific columns
{key} (str) - search optimization method (e.g. EQUALITY, SUBSTRING, GEO);
{value} (list)
{items} (str) - search optimization targets (column names and VARIANT column paths)
comment (str)
primary_key (list)
{items} (ident) - column names for PRIMARY KEY constraint
unique_keys (list)
{items} (list)
{items} (ident) - column names for UNIQUE KEY constraint
foreign_keys (list)
{items} (dict) - FOREIGN KEY definitions
columns (list)
{items} (ident) - column names from current table
ref_table (ident) - reference table
ref_columns (list)
{items} (ident) - column names from reference table
Policy reference parameters
aggregation_policy (dict)
columns (list)
{items} (ident) - optional reference column names defining "entity"
masking_policies (list)
{items} (dict)
columns (list)
{items} (ident) - reference column names
projection_policies (list)
{items} (dict)
column (ident) - reference column name
row_access_policy (dict)
columns (list)
{items} (ident) - reference column names
Usage notes
Columns definition has two possible syntax options:
a) Short syntax (str) with column type definition only. b) Full syntax (dict) with type definition as well as other properties.
Column default is an SQL expression, not value.
VARCHAR
values should be enclosed in quotes.TIMESTAMP_*
values should be casted explicitly.
Safe & unsafe operations
The following operations on tables are considered as "safe":
Create a new table from scratch;
Add a new column to the end of existing table;
Change comment on table;
Change comment on specific column;
All other operations are "unsafe".
Additionally, in order to execute CREATE OR REPLACE TABLE ... AS SELECT
, the following CLI option must be specified: --apply-replace-table
Links
Last updated