Introduction

With parameters you can inject data into your SQL statement. You can input plain text / numbers or inject data from Sheets or another block.

Add data from Sheets

https://youtu.be/d-lJOixrTcM

  1. Add a parameter to your SQL

    select e.*
    from dummy.events AS e
    where 1=1
    and e.email like '%{{email}}%'
    limit 200
    
  2. As soon as you add a parameter to your SQL, you'll see a "Params" section show up in SeekWell, select Sheets as the Type

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d0e2a0d4-7899-41bb-b99a-4cb2d651c085/Untitled.png

  1. Select the Spreadsheet you want to grab the parameter value from and the cell using A1 notation (e.g. Sheet1!A1). You can only use a single cell (except Postgres and Snowflake, see below). If you need to reference multiple cells, use and / or statements.
  2. Run the query and you'll get results based on your parameters!

Add data from another Block

Select "Block" as the parameter type

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f36c09cc-ec37-4aba-8fa9-2f6004ab4a71/Untitled.png

Lists and Tables (Postgres and Snowflake only)

You can also use a Sheet range (i.e. more than one cell) to generate a SQL list (e.g. where some_column in (1, 2, 3)). To use the list in your query, simply add the parameter (no parens, quotes, etc. needed), for example:

select *
from some_table as d
where d.some_column in {{vals}}

https://www.loom.com/share/99932d730759461cabc6e136e7d61020