Parameters
Parameters are named values defined once for a flow and used in any of its nodes. Instead of writing the same value into several fields, the value is kept in one place and referenced wherever it is needed.
They are most useful for values that change between environments or runs, for example:
-
the schema or table a source reads (
orders_$$env), -
the directory a target writes to (
$$output_dir/daily), -
a value a filter compares against (
region = $$region).
Changing the parameter's value then changes every field that references it, without editing the nodes one by one.
Using a Parameter
A parameter is referenced in a node or flow field by writing its name
after $$:
$$param_name
The reference can stand alone or be part of a longer text:
| Field value | Parameter | Used as |
|---|---|---|
$$env |
env = prod
|
prod |
orders_$$env |
env = prod
|
orders_prod |
$$base_dir/exports |
base_dir =
/data
|
/data/exports |
The field keeps the reference exactly as it is typed; it is replaced with the parameter's value when the flow runs. When a value is needed earlier, e.g. to list the columns of a table whose name holds a parameter, the current value is used for that lookup only.
When one parameter name is the beginning of another ($$table
and $$table_name), the longer one is matched
first, so they do not get mixed up.
Where Parameters Cannot Be Used
Some names are used as written by the engine itself, so they cannot hold a
$$ reference:
- a node's output table name,
- a column name in a node's schema.
A reference is not checked against the type of the field it is used in.
For example, a filter comparing a number column with
$$limit is accepted while editing; if the value
is not a number, the error is reported when the flow runs.
Defining Parameters
Each parameter has the following fields:
| Field | Description |
|---|---|
| Name |
The name used after $$. Only letters,
numbers and underscore (_); must be
unique.
|
| Description | What the parameter is for. Optional, but helps others using the flow. |
| Type | Static or Expression. |
| Value | The value the references are replaced with. |
Add Parameter adds a new row, and the delete button on a row removes that parameter. Changes are applied with Save.
A parameter's name is stored without $$: a
parameter named env is referenced as
$$env.
Parameter Types
| Type | Description |
|---|---|
| Static | The value is used exactly as it is written. |
| Expression | The value is evaluated when the flow runs, and its result is used. |
Things to Know
- Parameters can only be edited on the default version of the flow. To change the parameters of another version, set it as default from the Versions panel first.
- While the job is locked by another user, parameters cannot be changed.
- Before renaming or deleting a parameter, check the fields that reference it: a reference to a parameter that no longer exists is not replaced.