HYBRID TABLE
Config path: /<database>/<schema>/hybrid_table/<name>.yaml
Example:
Schema
columns (dict)
{key} (ident) - column name
{value} (str) - full data type with optional "NOT NULL" constraint --- OR ---
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
indexes (list)
{items} (dict) - INDEX definition
columns (list)
{items} (ident) - column names to be indexed
include (list)
{items} (ident) - column names to additionally include for covering index
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 type is a full native Snowflake data type definition, exactly how it appears in output of DESC TABLE command. Aliases and short forms are not allowed.
Column default is an SQL expression, not value.
VARCHAR
values should be enclosed in quotes.TIMESTAMP_*
values should be casted explicitly.Anonymous auto-increment is not supported. All sequences must be created explicitly and assigned to
default_sequence
of relevant table columns. It helps to preserve sequence value when table is re-created.
Safe & unsafe operations
At this moment only the following operations are "safe" for hybrid tables:
Create a new hybrid table
Add or remove unique key from hybrid table
Add or remove foreign key from hybrid table
All other changes would be resolved as "unsafe" CREATE OR REPLACE TABLE ... AS SELECT
command. In order to apply this command, you also need to specify the following CLI option: --apply-replace-table
Hybrid tables are designed to be relatively small (less than 100Gb), so replacement should be a relatively cheap operation. We may consider implementing basic table and secondary index transformations in future once Hybrid table feature is available in all regions and leaves "Public preview".
Links
Last updated