Registry / database / node-database-executor

node-database-executor

JSON →
library2.4.24jsnpmunverified

A lightweight Node.js database query executor supporting both JSON-based queries (jsonQuery) and raw SQL queries. Version 2.4.24 is current stable, with frequent updates. It supports MySQL, MS SQL, PostgreSQL, and SQLite across multiple drivers (mysql, mssql, pg, sql.js). Key differentiator: provides a declarative JSON query language abstraction over raw SQL, reducing SQL injection risks and simplifying dynamic query building. Uses a promise-based API. Active development with regular releases.

npm install node-database-executor
INSTALL
IMPORT
SIG · NODE-DATABASE-EXEC
N
node-database-executor
databasejavascriptv2.4.24
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

promise
✓ import { promise } from 'node-database-executor'
✗ const promise = require('node-database-executor').promise
ESM import since v2.x. CJS require still works but is deprecated.
executeQuery
✓ promise.executeQuery(config)
✗ executeQuery(config)
executeQuery is a method of the promise object, not a standalone export.
jsonQuery
✓ import { promise } from 'node-database-executor'; promise.executeQuery({query: jsonQueryObject})
✗ import { jsonQuery } from 'node-database-executor'
jsonQuery is not a separate export; use within executeQuery config.

Executes a JSON query against a MySQL database using promise API. Demonstrates query building and config setup.

import { promise } from 'node-database-executor'; async function run() { const query = { table: 'users', select: ['id', 'name'], where: { active: true } }; const config = { dbConfig: { databaseType: 'mysql', engine: 'InnoDB', database: 'mydb', host: 'localhost', port: 3306, user: 'root', password: process.env.DB_PASS ?? '', connectionLimit: 10, acquireTimeout: 2000 }, query: query }; try { const result = await promise.executeQuery(config); console.log(result); } catch (err) { console.error(err); } } run();
Debug
Known issues
breakingBefore v2.0, the library exported a promise chain instead of a promise object. Use promise.executeQuery now.
fix
Update code to use promise.executeQuery(config) instead of promise(config).then(...).
affects: <2.0.0
deprecatedCJS require is deprecated. Use ESM import instead.
fix
Replace const x = require('node-database-executor') with import { promise } from 'node-database-executor'.
affects: >=2.0.0
gotchaThe dbConfig.password is required even for local development; omitting it throws a cryptic error.
fix
Always provide a password (can be empty string '' ) in dbConfig.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: promise.executeQuery is not a function
Using CJS require with missing .promise or using wrong import (e.g., import { executeQuery } directly).
fix
Use import { promise } from 'node-database-executor' then call promise.executeQuery()
Cannot read property 'executeQuery' of undefined
Forgetting to call .promise on the required module in CJS.
fix
const queryExecutor = require('node-database-executor').promise;
ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'
Missing or incorrect password or user in dbConfig.
fix
Verify dbConfig.user and dbConfig.password match your MySQL credentials.
Upgrade
Version history
2.4.24latest on npm
Audit
Dependencies
mysqloptionalMySQL database driver
mssqloptionalMS SQL database driver
pgoptionalPostgreSQL database driver
sql.jsoptionalSQLite database driver (in-memory)
Agent activity
11 hits · last 30 days
node
10
Anthropic
1
Resources
node-database-executor — npm install node-database-executor · libregistry