Package Information
Available Nodes
Documentation
n8n-nodes-code23-duckdb
A custom n8n node for executing SQL queries on DuckDB, an in-process SQL OLAP database.
Features
- Execute SQL Queries: Run SQL queries against DuckDB databases
- Connection Pooling: Efficient connection management for better performance
- Type Safety: Full TypeScript support with proper type definitions
- Flexible Input: Support for parameterized queries and dynamic SQL generation
- n8n Integration: Seamless integration with n8n workflows as an input node
Prerequisites
⚠️ Important: Docker Configuration
This node is NOT compatible with the default n8n Docker image!
The default n8n Docker container is based on Alpine Linux, which is incompatible with DuckDB. Installing this node in an Alpine-based container will destroy the container.
Solution
You must use a Debian-based Docker image for n8n. See the included Dockerfile in this repository as an example of a working Debian-based setup:
FROM node:22-bookworm-slim
# ... rest of configuration
To use this node with n8n in Docker:
- Build a custom Docker image using the provided
Dockerfileor create your own based onnode:22-bookworm-slimor similar Debian variant - Include system dependencies required for building native modules (python3, build-essential, etc.)
- Install n8n and the DuckDB node in the custom image
Installation
Clone the repository:
git clone https://github.com/stenet/n8n-nodes-code23-duckdb.git
cd n8n-nodes-code23-duckdb
Install dependencies:
npm install
Development
Start n8n with the node loaded and watch for changes:
npm run dev
This will:
- Start n8n locally (usually at http://localhost:5678)
- Load your DuckDB node
- Enable hot reload for development changes
Available Commands
| Command | Description |
|---|---|
npm run dev |
Start n8n with watch mode |
npm run build |
Build the node for production |
npm run lint |
Check code for linting issues |
npm run lint:fix |
Automatically fix linting issues |
Usage
Adding the Node to a Workflow
- Open n8n and create a new workflow
- Click the plus icon to add a node
- Search for "DuckDB"
- Select the DuckDB node
Configuration
- Credentials: Set up DuckDB API credentials (database file path or connection string)
- Operation: Select "Execute SQL"
- SQL Query: Enter your SQL query
Example
SELECT * FROM table_name WHERE column = $1
Project Structure
├── nodes/
│ └── DuckDB/
│ ├── DuckDb.node.ts # Main node class
│ ├── DuckDB.node.json # Node metadata
│ ├── resources/
│ │ └── executeSQL/ # SQL execution operation
│ └── shared/ # Shared utilities
├── credentials/
│ └── DuckDbApi.credentials.ts # DuckDB credentials
├── icons/ # Node icons
└── package.json
Building and Publishing
Build for Production
npm run build
This compiles TypeScript and outputs to the dist/ directory.
Publish to npm
npm publish
Before publishing, ensure:
- Version in
package.jsonis updated - Changes are committed to git
- All tests pass and code is linted
Troubleshooting
Node not appearing in n8n
- Ensure dependencies are installed:
npm install - Verify the node is registered in
package.jsonundern8n.nodes - Restart the dev server:
npm run dev - Check browser console for error messages
Connection Issues
- Verify DuckDB credentials are correctly configured
- Check that the database file path or connection string is accessible
- Review n8n logs for detailed error messages
Linting Errors
Run npm run lint:fix to automatically fix most issues.
Resources
Author
Stefan Heim - stefan.heim@hotmail.com