Introduction to Parameters
Parameters can be used to create global constants. A parameter can be used with a $ sign, like$status
in this parameterized filtered metric:
- Global value (per workspace)
- In a domain
- In a query (when using the SQL interface) or in a dynamic dataset
Using parameterized semantics in a dynamic dataset deployed as a VIEW allows to create parameterized views
Parameterized Dynamic Datasets
Dynamic datasets can include calculations with parameters. The value of the parameter when in a user query is by this order:- Value set in real-time by user with a
SET
command. - Default value set in the dynamic dataset
- Default value set in the domain
- Default value set in the workspace
Deploying to VIEWs
When a dynamic dataset is deployed as a SnowflakeVIEW
, parameters can be set using the Snowflake SET
statement:
Deploying to TABLEs
When a dynamic dataset is deployed as a Snowflake TABLE (regular or dynamic) the default values of parameters are used, as set in the dynamic dataset configuration.Using parameters within a SQL interface connection
If there is a SQL interface table or domain calledworld
, and a parameter called param
, set it as:
world
with 12 as the value of parameter param
.
Dynamic parameters using UDFs
Parameter values can be computed using user defined functions (UDF) in Snowflake, by using the UDF in the parameter expression:world
with parameter param
set to the result of UDF my_udf(12)
.
This approach allows complex computation of parameters, using other functions or data in Snowflake.
For example, a user parameter can be used to extract value from a lookup table:
YAML Schema
Every parameter is backed by a text file in git that defines it, and keeps history of every change. The schema for parameter is:name
: Name of parameter (global)value
: SQL constant expression (i.e. a number or a string)display_name
,owner
,description
,labels
,folder
,hidden
: Metadata