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)

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.

Last updated