Query Database
AI-generatedSummary
Run one read-only SQL query against a SQLite database supplied as binary input or read from an allowed absolute file path. Bind optional JSON parameters and return the query’s rows either as separate n8n items or together with query metadata in one item.
Inputs
- Input Mode (required) — Choose Binary or File Path. Binary reads the database from the selected Binary Property (default
data). File Path reads Database File Path, which must be absolute and fall under one of the Allowed Path Prefixes; the defaults are/files/and/home/node/.n8n-files/. - Query (required) — A single SQL statement. The operation permits SELECT, WITH queries, and PRAGMA table_info(...); it rejects write or other disallowed statements.
- Query Parameters — Optional JSON array or object bound to the prepared statement, for positional or named parameters. Leave blank when the query has no parameters.
- Return Mode (required) — Items returns one n8n item per row. Single Item returns one item containing the rows and query metadata.
Output shape
A list of n8n items containing query results.
In Items mode, each row is an item's
json; zero rows produce no result items. In Single Item mode, one item'sjsonincludesquery,rows,columns, androwCount, along with source and database input metadata. Binary values in rows are represented as base64 objects withencoding,length, anddatafields. Errors stop execution unless Continue On Fail is enabled.