SnowDDL
  • 👋Introduction
  • 🚩Getting started
  • 📋Main features
  • 🪤SnowDDL vs. Declarative DCM
  • In-depth guides
    • 👓Object identifiers
    • 📐Data types
    • 📦Object types
    • 🎭Role hierarchy
    • 🚧Permission model
    • 🔦Other guides
      • Administration user
      • Integrations
      • Inbound shares
      • Object OWNERSHIP
      • Safe & unsafe DDL
      • Dependency management
      • Short hash explained
      • Env Prefix explained
      • Team workflow
      • Limitations & workarounds
      • Fivetran
      • Airbyte
      • Encrypt user passwords
      • Iceberg Tables
  • Basic usage (CLI + YAML)
    • 💻CLI interface
    • 📦YAML configs
      • ACCOUNT PARAMETER
      • ACCOUNT POLICY
      • AGGREGATION POLICY
      • ALERT
      • AUTHENTICATION POLICY
      • BUSINESS ROLE
      • DATABASE
      • DYNAMIC TABLE
      • EVENT TABLE
      • EXTERNAL ACCESS INTEGRATION
      • EXTERNAL FUNCTION
      • EXTERNAL TABLE
      • FILE FORMAT
      • FUNCTION
      • HYBRID TABLE
      • ICEBERG TABLE
      • MASKING POLICY
      • MATERIALIZED VIEW
      • NETWORK POLICY
      • NETWORK RULE
      • PERMISSION MODEL
      • PIPE
      • PLACEHOLDER
      • PROCEDURE
      • PROJECTION POLICY
      • RESOURCE MONITOR
      • ROW ACCESS POLICY
      • SCHEMA
      • SECRET
      • SEQUENCE
      • SHARE (outbound)
      • STAGE
      • STAGE FILE
      • STREAM
      • TABLE
      • TASK
      • TECHNICAL ROLE
      • USER
      • VIEW
      • WAREHOUSE
    • 🏷️YAML placeholders
    • 📬YAML tag !include
    • 🔐YAML tag !decrypt
  • Single DB
    • 🦀Overview
  • Advanced usage (Python)
    • ⚙️Programmatic config
    • 🐍Architecture overview
      • 🔵Blueprints
      • 🟣Config
      • 🟠Parsers
      • 🟢Resolvers
      • 🔴Engine
    • 🏗️Query builder & formatter
  • Breaking changes log
    • 0.45.0 - March 2025
    • 0.41.0 - January 2025
    • 0.37.0 - December 2024
    • 0.36.0 - November 2024
    • 0.33.0 - October 2024
    • 0.27.0 - May 2024
  • Links
    • GitHub repository
    • PyPI package
    • YouTube tutorials
    • Changelog
    • LinkedIn profile
Powered by GitBook
On this page
  • Schema
  • Usage notes
  • Safe & unsafe operations
  • Links
  1. Basic usage (CLI + YAML)
  2. YAML configs

HYBRID TABLE

Config path: /<database>/<schema>/hybrid_table/<name>.yaml

Example:

columns:
  actor_id: NUMBER(10,0) NOT NULL
  first_name: VARCHAR(45) NOT NULL
  last_name: VARCHAR(45) NOT NULL
  last_update: TIMESTAMP_NTZ(3)

primary_key: [actor_id]
columns:
  ticket_no:
    type: VARCHAR(13) NOT NULL
    comment: "Ticket number"

  flight_id:
    type: NUMBER(10,0) NOT NULL
    comment: "Flight ID"

  boarding_no:
    type: NUMBER(10,0) NOT NULL
    comment: "Boarding pass number"

  seat_no:
    type: VARCHAR(4) NOT NULL
    comment: "Seat number"

primary_key: [ticket_no, flight_id]

unique_keys:
  - [flight_id, boarding_no]
  - [flight_id, seat_no]

foreign_keys:
  - columns: [ticket_no, flight_id]
    ref_table: ticket_flights
    ref_columns: [ticket_no, flight_id]

indexes:
  - columns: [flight_id]

Schema

  • columns (dict)

    • {key} (ident) - column name

    • {value} (dict)

      • default (str) - default SQL expression

      • default_sequence (ident) - sequence used for "auto increment"

      • comment (str)

  • 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

  1. 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.

  2. Column default is an SQL expression, not value. VARCHAR values should be enclosed in quotes. TIMESTAMP_* values should be casted explicitly.

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

PreviousFUNCTIONNextICEBERG TABLE

Last updated 1 year ago

{value} (str) - full with optional "NOT NULL" constraint --- OR ---

type (str) - full with optional "NOT NULL" constraint

collate (str) - column for string comparison

Column type is a full native Snowflake data type definition, exactly how it appears in output of command. Aliases and short forms .

Anonymous auto-increment is not supported. All must be created explicitly and assigned to default_sequence of relevant table columns. It helps to preserve sequence value when table is re-created.

📦
data type
data type
collation
DESC TABLE
are not allowed
sequences
CREATE HYBRID TABLE
SHOW HYBRID TABLES
DESC TABLE
Parser & JSON Schema (GitHub)