📬YAML tag !include

SnowDDL supports custom !include tag in YAML configs. When parser encounters this tag, it loads specified file and uses its contents as value for YAML parameter.

It helps to store SQL or UDF code into separate files instead of putting everything inside YAML, which leads to significant improvement of developer experience by providing syntax highlighting and auto-completion.

It is primarily intended to be used with VIEW parameter text and FUNCTION & PROCEDURE parameter body.

Example

my_view.yaml config file:

text: !include my_view.sql

my_view.sql file:

SELECT id, name
FROM my_table

Usage notes

  • Include paths are relative to source YAML file. It is possible to "include" from the same directory or from any sub-directory relative to YAML file. Examples of valid paths: my_view.sql, sql/my_view_sql.

  • Loading files from parent directory or using absolute paths are not allowed due to security concerns.

  • !include can be used with files of any type, including *.py, *.java, *.sql, etc.

  • YAML placeholders in included files are correctly resolved.

Last updated