Parameters
In the steps below we show an example of how you can use parameters in your SQL queries:
Click the parameter icon (<I>
) in the righthand side toolbar:
and then click anywhere on the canvas
You should see a parameter block now on the canvas. In this example we will name the parameter block block_id
and fill in the block with a UUID:
Next, we will create a new cell block and fill it with the following SQL query. Note the {{}}
notation, this will create a parameterized variable in the query:
Now, whenever we run the SQL cell block, the outputted results will change based off whatever is filled in the parameter block (block_id
).
NOTE: your input parameter data type matters. If your SQL block is expecting a string or integer that should be specified in the block settings. In your SQL block that has the parameter, under parameter settings you can set the parameter type:
Create input parameters based off a SQL-select statement
Create a parameter block and a SQL block.
In this example we will name the parameter block team domain
and have a list of possible parameters based off the results from the SQL block called unique domains
. Our canvas now looks like this with these two blocks:
In the team domain
parameter block, click the 3-dot menu in the upper right, select Settings, change the block subtype to select
. Then set the Source Block to unique domains
and set the Column to the DOMAIN
column from the unique domains
SQL block result:
Your team domain
parameter block should now have a list of all the results from the unique domains
SQL block as possible input parameters:
Using parameters with LIKE
or ILIKE
Concatenate the parameter within the LIKE
or ILIKE
lookup string like so: