Notebook parameters without the query storm
Typed notebook parameters written as safe literals per engine, an Apply bar that holds database queries, linked dropdowns and sensitive values.
Picture a notebook with three filters at the top, country, date range and minimum freight, and six queries under them, two of them on production. You click into the country box and type "Germany". If every keystroke re-ran every query that uses the filter, that's seven letters times six queries hitting your servers while you're still spelling.
That's the query storm, and it's the obvious way to get reactive parameters wrong. This post is about how SQLly's notebook parameters work and what keeps them from doing that. It's part of a series on SQLly notebooks.
Both parameter notebooks from this post, recorded in the app: a country typed into the freight review waits for Apply, and the City list follows the Country you pick. Watch the whole recording, with chapters.
A parameter is a typed value with an input to match
In the first version, parameters were text in a bar at the top. Now each one has a type, and the type picks its input. Text and search boxes, whole and decimal number fields with steppers, a yes/no switch, date and date-time pickers, a date-range picker, dropdowns, multiple choice, a lookup for picking one record from a query, a slider, an allow-listed table or column name, and a secret picker. You add them from the Parameters page on the left rail, or put one in a Parameter cell between other cells. Both are the same parameter, so changing it in one place changes it everywhere.
In SQL you write :region, @region or {{param.region}}. In Markdown, {{param.region}} shows the value in the text. A date range gives you .start, .end and .end_exclusive, the day after the end, for the < comparison everyone gets wrong at least once:
SELECT ShipCountry, SUM(Freight) AS Freight
FROM dbo.Orders
WHERE OrderDate >= {{param.period.start}}
AND OrderDate < {{param.period.end_exclusive}}
AND ShipCountry IN :countries
GROUP BY ShipCountry
Values go in as literals for each engine
SQLly can't pass parameter values to the database separately from the SQL today. So it writes each value into the query as a proper literal for that cell's engine. Strings become N'...' on SQL Server and E'...' with escapes on PostgreSQL. A date is CAST('20261101' AS date) on SQL Server, DATE '2026-11-01' on most engines and toDate(...) on ClickHouse. Negative numbers get parentheses. A multiple choice becomes a list like (a, b), and (NULL) when nothing is picked, so IN still works.
Only declared parameters are replaced, and only in live code. Strings, comments, quoted names, @@ROWCOUNT-style names and :: casts are left alone. The literal writer was tested with hostile parameter text on five engines, because a parameter must never be a way to inject SQL.
One SQL Server gotcha: a script that DECLAREs a variable with the same name as a parameter still gets the parameter's value written in. Give them different names.
Choices can come from a query, and follow each other
A dropdown, multiple choice, search or lookup can take its options from a fixed list or from a read-only query on one of the notebook's connections, such as SELECT code, name FROM regions ORDER BY name. The query has to be a single SELECT, runs on a read-only copy of the connection, and stops at 1,000 rows by default (10,000 at most) with "Showing the first 1,000 options; narrow the query to see the rest." Options queries wait until the notebook is trusted and their connection is allowed, so a notebook from somewhere else can't fire them just by being opened.
An options query can use another parameter. Make the city list depend on {{param.country}} and changing the country re-reads the cities. A city that's no longer offered gets cleared, which in turn marks the cells that use it out of date.
Nothing hits a database until you say so
Here's how the storm doesn't happen. By default, changing a parameter only marks the cells that use it out of date. You decide when to run them. Typing also waits for a short pause before the value changes, so cells aren't marked stale on every keystroke.
If you want a notebook that reacts on its own, switch on Re-run on change on the Parameters page. Then a change splits the affected cells in two. Cells that compute inside the notebook, like charts, tables, formulas, transforms and cells on the local DuckDB data, re-run straight away. They're mostly working on rows already on your computer. Cells that query a database line up in an Apply bar instead: "Database cells waiting for Apply: 3", each listed with its connection and environment badge, Production included. Apply runs them in notebook order. Discard drops the change.
For filters you tend to change together, set a parameter to wait for Apply before cells use a new value. Your edit sits as a draft under the input until you press Apply, so you can change three filters and run once. Dashboards go one step further. Their filter bar uses the same inputs as the Parameters page, with the same drafts, and it never starts a query by itself. After you apply a value it tells you what refreshing would cost, "Refreshing runs 3 queries on Storefront Prod.", and nothing runs until you press Refresh.
Sensitive values stay off the record
Mark a parameter Sensitive and the input is masked, Markdown shows dots instead of the value, and formula cells can't read it. It's never saved in the notebook file, your personal file, saved sets, run history, query history or the activity panel, and exports replace it with [redacted]. The SQL hashes kept in run records and the audit log are taken with the value left out, so it can't be guessed back from a hash. The database still receives the value when a cell runs. That's the point of a parameter.
Personal parameters keep each person's value outside the notebook file, so sharing a notebook doesn't share your picks. Saved sets come in both flavors too: a shared set lives in the notebook for everyone, and "my set" stays on your computer.
What's not done
Secret parameters are half there. You can pick a secret by name from your system keychain, or store a new one, and the value is never shown or saved. But since SQLly can't yet send a value to the database separately from the SQL text, a cell that uses a secret is refused rather than writing the secret into the query. That needs native driver parameters, which notebooks don't have yet.
Secrets can only be stored in the desktop app. Pattern (regular expression) validation isn't available. Options that come from another cell's result are empty until that cell has run. And there are no palette commands for Apply or Add parameter yet.
The full list of types, presets and flags is on Parameters and inputs. The fingerprinting that decides which cells go stale is in the previous post, and the next one is about joining results from two different databases. If your parameters ever set off a storm anyway, tell me what you clicked.