SnowDDL
Search
K
Comment on page

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
  • depends_on (list)
    • {items} (ident) - names of other views which this view depends on
  • comment (str)

Usage notes

  1. 1.
    Invalid views will be re-created automatically, even if view definition remains exactly the same.
  2. 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. 3.
    You may use custom YAML tag !include to store view SQL text in a separate file instead of storing it inside YAML.
Last modified 6mo ago