{"id":18604,"library":"node-database-executor","title":"Node Database Executor","description":"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.","status":"active","version":"2.4.24","language":"javascript","source_language":"en","source_url":"https://github.com/darshit-shah/node-database-executor","tags":["javascript"],"install":[{"cmd":"npm install node-database-executor","lang":"bash","label":"npm"},{"cmd":"yarn add node-database-executor","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-database-executor","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"MySQL database driver","package":"mysql","optional":true},{"reason":"MS SQL database driver","package":"mssql","optional":true},{"reason":"PostgreSQL database driver","package":"pg","optional":true},{"reason":"SQLite database driver (in-memory)","package":"sql.js","optional":true}],"imports":[{"note":"ESM import since v2.x. CJS require still works but is deprecated.","wrong":"const promise = require('node-database-executor').promise","symbol":"promise","correct":"import { promise } from 'node-database-executor'"},{"note":"executeQuery is a method of the promise object, not a standalone export.","wrong":"executeQuery(config)","symbol":"executeQuery","correct":"promise.executeQuery(config)"},{"note":"jsonQuery is not a separate export; use within executeQuery config.","wrong":"import { jsonQuery } from 'node-database-executor'","symbol":"jsonQuery","correct":"import { promise } from 'node-database-executor'; promise.executeQuery({query: jsonQueryObject})"}],"quickstart":{"code":"import { promise } from 'node-database-executor';\n\nasync function run() {\n  const query = {\n    table: 'users',\n    select: ['id', 'name'],\n    where: { active: true }\n  };\n  const config = {\n    dbConfig: {\n      databaseType: 'mysql',\n      engine: 'InnoDB',\n      database: 'mydb',\n      host: 'localhost',\n      port: 3306,\n      user: 'root',\n      password: process.env.DB_PASS ?? '',\n      connectionLimit: 10,\n      acquireTimeout: 2000\n    },\n    query: query\n  };\n  try {\n    const result = await promise.executeQuery(config);\n    console.log(result);\n  } catch (err) {\n    console.error(err);\n  }\n}\nrun();","lang":"typescript","description":"Executes a JSON query against a MySQL database using promise API. Demonstrates query building and config setup."},"warnings":[{"fix":"Update code to use promise.executeQuery(config) instead of promise(config).then(...).","message":"Before v2.0, the library exported a promise chain instead of a promise object. Use promise.executeQuery now.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Replace const x = require('node-database-executor') with import { promise } from 'node-database-executor'.","message":"CJS require is deprecated. Use ESM import instead.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Always provide a password (can be empty string '' ) in dbConfig.","message":"The dbConfig.password is required even for local development; omitting it throws a cryptic error.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use import { promise } from 'node-database-executor' then call promise.executeQuery()","cause":"Using CJS require with missing .promise or using wrong import (e.g., import { executeQuery } directly).","error":"TypeError: promise.executeQuery is not a function"},{"fix":"const queryExecutor = require('node-database-executor').promise;","cause":"Forgetting to call .promise on the required module in CJS.","error":"Cannot read property 'executeQuery' of undefined"},{"fix":"Verify dbConfig.user and dbConfig.password match your MySQL credentials.","cause":"Missing or incorrect password or user in dbConfig.","error":"ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}