Database
A Database node runs one SQL statement on one of your organization’s databases: a lookup, an insert, an update. Its rows are the step’s output, so later steps can read them. Databases are SQLite. See Databases to create one and Querying from agents and workflows for patterns.
Settings
Section titled “Settings”| Field | What it does |
|---|---|
| Database (required) | One of your organization’s databases |
| SQL (required) | One statement. The editor completes the picked database’s table and column names. |
With no databases yet, the panel links to the Databases page to create one. If the picked database is deleted later, the field reads “A deleted database”, and the step fails until you pick another.
Values from the run
Section titled “Values from the run”Write {{ }} wherever a value goes:
select name, plan from customers where email = {{ trigger.email }}Each {{ }} is sent to the database as a bound parameter, never pasted into the statement. A quote
in the value can’t change the query, and you don’t put quotes around it. Filters work as anywhere
else, such as {{ trigger.email | downcase }}.
| The value is | It binds as |
|---|---|
| Text or a number | That text or number |
| true or false | 1 or 0 |
| An object or list | Its JSON text |
| Missing | null |
A parameter stands for a value only. A table or column name can’t come from a variable. Liquid
tags such as {% if %} are refused with “SQL templates take values only, no tags”.
Output
Section titled “Output”| Field | What it holds |
|---|---|
rows |
The rows the statement returned, each keyed by column |
columns |
The column names, in order |
rowCount |
How many rows the statement returned |
The next step’s {{ input }} is the rows as JSON. A later step can loop over them:
{% for row in nodes.lookup.rows %}- {{ row.name }}: {{ row.plan }}{% endfor %}A statement that writes and returns nothing gives empty rows. Add returning * to an insert or
update to get the written rows back.
Size limit
Section titled “Size limit”A step’s result is capped at 256 KiB of rows. Past that, the statement is rolled back and the step
fails, asking you to add a LIMIT or select fewer columns.
Publish checks
Section titled “Publish checks”Publish refuses a Database node with no database picked, no SQL, a Liquid tag in the SQL, or a
{{ }} that isn’t valid Liquid.