
Using an input block.
Using input values within SQL blocks
You can use the value of an input within a SQL block by using the{{ your_variable }}
syntax. For example, if you have an input named start_date
, you can use its value in a SQL query like this:
{{ start_date }}
with the value of the start_date
input when running the query.
You can interpolate any variables within SQL queries, not only variables tied to input blocks. This allows you to create dynamic queries that depend on the values of your inputs, Python blocks, or even environment variables.
Input types
In addition to text inputs, you can also add dropdowns and date pickers to your pages. Dropdowns allow you to select a value from a list of options that can be either statically defined or dynamically generated from a data frame’s column. Date pickers allow you to select a date from a calendar widget.Dynamic dropdowns
You can automatically populate a dropdown with values from a data frame’s column by selecting the data frame and column in the dropdown block’s settings.
Using a dropdown block with dynamic values.