Description
n8n-nodes-sqlite3
This is an n8n community node. It lets you use SQLite3 in your n8n workflows.
SQLite3 is a lightweight, self-contained SQL database engine that stores all data in a single file and requires no server setup. It is ideal for embedded applications, local storage, and small to medium-sized projects.
n8n is a fair-code licensed workflow automation platform.
Installation
Follow the installation guide in the n8n community nodes documentation.
For local development:
npm run build
npm link
cd ~/.n8n/nodes
npm link n8n-nodes-sqlite3
Credentials
The node uses a SQLite Database credential to store the database path. Set it to an absolute path to your SQLite file:
/home/user/data/mydb.sqlite
The directory is created automatically if it does not exist. The file is created on first write if it does not exist.
Operations
All operations are available under the Database resource.
| Operation | Description |
|———–|————-|
| Select | Query rows from a table with optional WHERE filters, column selection, and sort |
| Insert | Insert one or more rows into a table |
| Update | Update rows matching a column value |
| Delete | Delete rows matching a column value, or drop a table |
| Create or Update | Insert or replace rows based on a conflict key (upsert) |
| Execute SQL | Run arbitrary SQL, including DDL and multi-statement scripts |
Execute SQL
Use this operation for DDL statements (CREATE TABLE, DROP, ALTER) or any SQL not covered by the structured operations. Multiple statements separated by ; are all executed in a single call.
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
email TEXT UNIQUE,
age INTEGER,
createdat DATETIME DEFAULT CURRENTTIMESTAMP
);
!rowraw_query.png”>Insert with parameterized query
Allow Expressions in Query (unsafe)
By default, n8n expressions are not evaluated inside the SQL query field. This prevents expression-based SQL injection when user-controlled data flows through the workflow.
If you need to build the query dynamically using expressions (e.g., SELECT * FROM {{ $json.tableName }}), enable the Allow Expressions in Query (unsafe) toggle. Only do this when all data feeding into the query is trusted. Passing unsanitized user input into the query string can lead to SQL injection.
Select
Query rows from a table with optional WHERE conditions, column selection, sort rules, and a row limit.
Insert
Insert rows into a table. In Auto-Map Input Data to Columns mode, field names from the upstream node are matched to column names automatically, with no manual mapping needed.
Using as an AI Agent Tool
The node is marked as usableAsTool, which means it can be connected directly to an AI Agent node as a tool. The agent decides when to query the database and constructs the parameters autonomously.
Each operation can be used as a separate tool. Execute SQL is the most flexible: the agent writes the full query. The structured operations (Select, Insert, Update, etc.) are useful when you want to limit what the agent can do: a tool wired to Select cannot accidentally delete data.
!toolsrawqueryunsafe_detail.png”>Execute SQL called by AI agent with unsafe expressions enabled
Compatibility
Requires n8n with community node support. The native better-sqlite3 binding is pre-compiled for the musl-based Docker image shipped by n8n (node-v127-linux-musl-x64). When running outside Docker the node automatically falls back to the system’s own bindings with no configuration needed.
Building the native binding
The pre-built binary targets node-v127-linux-musl-x64 (the default n8n Docker image). To rebuild for a different target:
docker build -t better-sqlite3-builder .docker run --rm -it
-v ./.tmp:/app
-v ./native/node-v127-linux-musl-x64:/output
better-sqlite3-builder
Replace the output path with the appropriate ABI/platform directory for your target environment.
Resources
Contributing
Contributions are welcome. Open an issue or pull request on GitHub.