MyBatis-style database helper for Node-RED that provides CRUD nodes, SQL mapper with template engine (dynamic parameters, conditionals, foreach loops), and multi-database support for MySQL (auto-installed mysql2) and SQLite (requires manual better-sqlite3 install). Current version 1.0.24 targets Node-RED 4.0+, Node.js 18+. Key differentiators: snake_case to camelCase mapping, runtime dynamic parameters via msg, and transaction support. Released under an unspecified license with no release cadence given; appears actively maintained for its niche but not widely used.
npm install tangbao-he-db-helperNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to install and use the tangbao-db-query node with dynamic SQL via msg.payload.
Install better-sqlite3: npm install better-sqlite3
Use '#{param}' for user-supplied values to use prepared statements; avoid '${param}' unless absolutely necessary and the value is sanitized.Upgrade Node-RED to 4.0.0 or later: npm install node-red@latest
Ensure msg.payload is an object or undefined when using msg.params or msg.sql explicitly.
Use Node-RED's credentialSecret setting to encrypt sensitive data.
Run: cd ~/.node-red && npm install better-sqlite3
Add a tangbao-db-config node to the flow and configure it with database credentials, then connect it to the tangbao-db-query or tangbao-db-crud node.
Verify the SQLite database file path in the config node and ensure the table exists. If the file is created automatically, it will be empty; run CREATE TABLE statements first.
Check username, password, and host in the tangbao-db-config node; ensure the MySQL user has access to the specified database from the Node-RED host.