ðĶYAML configs
SnowDDL config is a directory with YAML files describing desired state of objects in Snowflake. You may find a sample config in SnowDDL GitHub repository.
Fundamentally, there are two types of objects in Snowflake:
Account-level objects
DATABASE, WAREHOUSE, ROLE, etc.
Account-level objects are normally described by single YAML file located in the root level of config directory.
For example, all warehouses are described in /warehouse.yaml
.
Schema-level objects
TABLE, VIEW, FUNCTION, etc.
Schema-level objects are normally described by one YAML file per object located in sub-directories representing database and schema where object is located, as well as an object type.
For example: /test_db/test_schema/table/test_table.yaml
.
This object:
belongs to database
TEST_DB
belongs to schema
TEST_DB.TEST_SCHEMA
it is a
TABLE
its name is
TEST_TABLE
Some schema-level objects support overloading (FUNCTION, PROCEDURE). It means that you may have multiple objects of this type in the same schema and with the same name, but with different arguments. In this case you must include base data types of arguments in the name of YAML config file.
For example: /test_db/test_schema/function/my_function(number,varchar).yaml
.
Documentation structure
The following pages describe configuration format for each object type.
Every page starts with config path, followed by some examples, followed by detailed schema description, followed by usage notes and links.
Links always contain URL's to relevant Snowflake commands and to the code of specific YAML parser with JSON schema. You should be able to check all technical details using provided links.
Small number of properties are highlighted with red. Such properties are "required".
Object identifiers in YAML configs
When you see data type (ident)
in schema description, it means this is the name of another object. For example, when one table refers to another using FOREIGN KEY.
For account-level objects, column names, parameter names - use name "as is".
For schema-level objects you may use fully-qualified names (<database>.<schema>.<name>
), but you may also use a short name (<name>
). It means that ref object is located in the same schema as current object.
This is very handy when you need to move some objects from one schema to another. There is no need to maintain fully qualified references all the time.
YAML format and data types
YAML format is a bit complicated. You may find some good external tutorials:
YAML data types are important for SnowDDL parsers, especially for account, session, copy parameters.
Incorrect data type will cause DDL query to fail. SnowDDL does not store "correct" data types for each parameter to make sure it will be compatible with any future changes.
Last updated