SnowDDL
Search…
🏷
YAML placeholders
SnowDDL supports placeholders in YAML configs. Placeholder format is similar to GitHub Actions:
${{ <placeholder> }}
Examples:
my_warehouse:
size: ${{ wh_size }}
auto_suspend: ${{ wh_auto_suspend }}
url: s3://${{ bucket_name }}/my_path/
storage_integration: test_storage_integration
file_format: test_avro_format

Configuration

Placeholders should be defined in config path: /placeholder.yaml
Example:
wh_size: SMALL
wh_auto_suspend: 300
bucket_name: dev-test-bucket
Additionally, you may specify a path to file with environment-specific placeholder values. For example, you may use it to override bucket_name from dev-test-bucket in DEV environment to prod-test-bucket in PROD environment.
bucket_name: prod-test-bucket
CLI option is --placeholder-path :
snowddl \
-c <config> \
-a <account_identifier> \
-u <user> \
-p <password> \
--placeholder-path=<path_to_custom_placeholder.yaml>
apply

Placeholders from command line argument

Alternatively, it is possible to specify custom placeholder values using CLI argument --placeholder-values. This argument accepts JSON string. For example:
snowddl \
-c <config> \
-a <account_identifier> \
-u <user> \
-p <password> \
--placeholder-values="{'bucket_name': 'prod-test-bucket'}"
apply
Data types of JSON values are important!
For example, placeholders for BOOLEAN values should be specified as JSON true or false without quotes. Numeric values should not have quotes as well.

Technical placeholders

A small number of placeholders are created automatically and always available. These placeholders can still be overloaded by config if necessary.
  • env_prefix (str) - contains current env prefix value. For example, if env prefix is ALICE, this placeholder will contain ALICE__. It should be used as a part of raw SQL fragments when it is necessary to access object in another database. It is especially useful for VIEW definitions. For example: ${{ env_prefix }}db_name.schema_name.object_name.

Usage notes

  1. 1.
    Data types of placeholder values are preserved. You may use integers, booleans, floats, etc.
  2. 2.
    All placeholders should be defined explicitly. Undefined placeholders will raise an exception and stop further execution to prevent an accidental damage.
Copy link
On this page
Configuration
Placeholders from command line argument
Technical placeholders
Usage notes