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
      • DATABASE ROLE
      • 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
  • Policy reference parameters
  • Usage notes
  • Links
  1. Basic usage (CLI + YAML)
  2. YAML configs

VIEW

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

Example:

columns:
  aircraft_code: "Aircraft code, IATA"
  model: "Aircraft model"
  range: "Maximal flying distance, km"

text: |-
  SELECT ml.aircraft_code,
      lang(ml.model) AS model,
      ml.range
  FROM aircrafts_data ml

comment: >-
  Each aircraft model is identified by its three-digit code (aircraft_code).
  The view also includes the name of the aircraft model (model) and the maximal flying distance, in kilometers (range).

Schema

  • columns (dict)

    • {key} (ident) - column name

    • {value} (str) - column comment

  • text (str) - view text

  • is_secure (bool) - is view secure

  • change_tracking (bool) - enable change tracking for this VIEW and underlying tables

  • depends_on (list)

    • {items} (ident) - names of other views which this view depends on

  • comment (str)

Policy reference parameters

  • aggregation_policy (dict)

    • policy_name (ident) - name of AGGREGATION POLICY

    • columns (list)

      • {items} (ident) - optional reference column names defining "entity"

  • masking_policies (list)

    • {items} (dict)

      • policy_name (ident) - name of MASKING POLICY

      • columns (list)

        • {items} (ident) - reference column names

  • projection_policies (list)

    • {items} (dict)

      • policy_name (ident) - name of PROJECTION POLICY

      • column (ident) - reference column name

  • row_access_policy (dict)

    • policy_name (ident) - name of ROW ACCESS POLICY

    • columns (list)

      • {items} (ident) - reference column names

Usage notes

  1. Invalid views will be re-created automatically, even if view definition remains exactly the same.

  2. If you want to access objects from another database in VIEW definition, and if you want to preserve env prefix support for such views, please use the env_prefix placeholder. For example: ${{ env_prefix }}db_name.schema_name.object_name. You may access objects in the same database by omitting database name altogether.

  3. You may use custom YAML tag !include to store view SQL text in a separate file instead of storing it inside YAML.

Links

  • CREATE VIEW

  • SHOW VIEWS

  • DESC VIEW

  • Parser & JSON Schema (GitHub)

PreviousUSERNextWAREHOUSE

Last updated 5 months ago

📦