Skip to content
Docs

Table Store Query

Table Store Query runs a read-only SQL query against your workspace’s table stores and emits the result set as a JSON array. Use it to look up reference data, join stores, or check whether a record already exists before inserting. You find it on the node picker’s Storage shelf.

The Table Store Query node's settings form, with the fields described below
The Table Store Query node's settings form, with the fields described below
FieldTypeDefaultDescription
Query (query)string ✦ (required) — One SELECT over this workspace’s tables; matching rows are returned as the node output. Writes and every other table are refused.
Parameters (parameters)key-value map (optional) — Named parameters bound into the query’s placeholders.
On error (onError)string ✦ (optional) — What to do when the query fails on the data: fail the flow, or continue.

Fields marked ✦ accept expressions.

Try this node — run it once against your own workspace, with your credentials, without building a flow first.

There are two ways to inject dynamic values into the SQL string:

1. parameters map. Write a :name placeholder in the query and add a matching key under “Parameters”. Each value runs through the expression engine, then goes into the query as a quoted string that the database reads as data, never as SQL. Use this for every data value:

SELECT id, name, email
FROM table_store_d85k0rv160khb1q83lc0
WHERE email = :email AND status = :status
parameters:
email → {{ $prev->email }}
status → active

2. Expression engine directly. The query field itself runs through the expression engine, so echo tags and $prev/$start references resolve to text inside the SQL before it runs. Reserve this for structural parts of the query, such as a table name or a column list; pass data values through the parameters map instead.

The query runs with its own narrow database access, not with your workspace’s full access:

  • This workspace’s table stores, and nothing else. A query that names any other table, including another workspace’s store or a system table, is refused before it runs, and the error names the table.
  • One statement. Write a SELECT, a WITH … SELECT or a VALUES. A second statement after a semicolon is refused. One trailing semicolon is fine.
  • No changes. INSERT, UPDATE, DELETE, a WITH that deletes, and functions that write are all refused by the database. To change rows, use Table Store Insert, Table Store Upsert, Table Store Update or Table Store Delete.
  • 30 seconds. A query that runs longer is cancelled.

The node emits a JSON array of row objects whose keys are column names:

[
{ "id": "cust-001", "name": "Alice", "email": "alice@example.com" },
{ "id": "cust-002", "name": "Bob", "email": "bob@example.com" }
]

If no rows match, the output is an empty array [].

Whole numbers and booleans come out as JSON numbers and true/false. Decimal and money columns come out as strings, so 12.5000 keeps its scale and no precision is lost. Dates and times come out as text such as 2026-09-24 10:11:12.

An Agent can call this node as a tool. Because the database enforces that the query only reads this workspace’s table stores, it counts as a read-only tool and runs without pausing for approval, also in read-only mode.

With On error set to Continue with an error envelope, a refusal of the data (a value the database cannot cast, a query that runs past its time limit) completes the node with {"error": true, "message": "…"} instead of failing the run, so a later step can log it. A missing table always fails the run. A query Publicus refuses always fails the run.

Look up an existing record by email:

SELECT id
FROM table_store_d85k0rv160khb1q83lc0
WHERE email = :email
LIMIT 1
parameters:
email → {{ $prev->email }}

Pipe the output into a Conditional Exit with condition count($prev) > 0 to stop the flow when the customer already exists.

Aggregate across rows:

SELECT COUNT(*) AS total_count
FROM table_store_d85k0rv160khb1q83lc0
WHERE status = :status
parameters:
status → {{ $start->statusFilter }}