In the steps below we show an example of how you can use parameters in your SQL queries:

1

Click the parameter icon (<I>) in the righthand side toolbar:

and then click anywhere on the canvas

2

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:

3

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:

4

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

1

Create a parameter block and a SQL block.

2

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:

3

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:

4

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:

where u.EMAIL ilike '%' || {{domain}} || '%'