{"id":43475,"library":"nodeash-sql","title":"Nodeash SQL","description":"Nodeash SQL is a lightweight Node.js package for connecting to Microsoft SQL Server databases. Current stable version is 2.2.54. The package provides a simple SQLClient function that returns a promise resolving to DBWrite, DBRead, and checkDatabaseConnection helpers. It ships TypeScript types and uses an ESM-only import pattern. Compared to libraries like mssql or tedious, it aims for minimal configuration and rapid setup, but has limited documentation and community adoption.","status":"active","version":"2.2.54","language":"javascript","source_language":"en","source_url":"https://github.com/akhilxyz/nodeash#nodeash-sql","tags":["javascript","typescript"],"install":[{"cmd":"npm install nodeash-sql","lang":"bash","label":"npm"},{"cmd":"yarn add nodeash-sql","lang":"bash","label":"yarn"},{"cmd":"pnpm add nodeash-sql","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core SQL Server driver used for database operations","package":"mssql","optional":false}],"imports":[{"note":"ESM-only; CommonJS require will not work. Use ES module syntax.","wrong":"const { SQLClient } = require('nodeash-sql')","symbol":"SQLClient","correct":"import { SQLClient } from 'nodeash-sql'"},{"note":"Config keys must exactly match the property names: name, username, password, hostName.","wrong":"const DBConfig = { database, user, password, host }","symbol":"DBConfig","correct":"const DBConfig = { name, username, password, hostName }"},{"note":"SQLClient is async and returns a promise; must be awaited or used with .then().","wrong":"const { DBWrite, DBRead, checkDatabaseConnection } = SQLClient(DBConfig)","symbol":"DBWrite, DBRead, checkDatabaseConnection","correct":"const { DBWrite, DBRead, checkDatabaseConnection } = await SQLClient(DBConfig)"}],"quickstart":{"code":"import { SQLClient } from 'nodeash-sql';\nimport dotenv from 'dotenv';\ndotenv.config();\n\nconst DBConfig = {\n  name: process.env.databaseName ?? 'mydb',\n  username: process.env.username ?? 'sa',\n  password: process.env.password ?? '',\n  hostName: process.env.hostname ?? 'localhost'\n};\n\nasync function main() {\n  const { DBWrite, DBRead, checkDatabaseConnection } = await SQLClient(DBConfig);\n  const status = await checkDatabaseConnection();\n  console.log('Connection status:', status);\n  \n  // Example write\n  const writeResult = await DBWrite(`INSERT INTO users (name) VALUES ('test')`);\n  console.log('Write result:', writeResult);\n  \n  // Example read\n  const rows = await DBRead(`SELECT * FROM users`);\n  console.log('Read result:', rows);\n}\nmain().catch(console.error);","lang":"typescript","description":"Full example of SQLClient usage: config, connection check, write and read queries."},"warnings":[{"fix":"Use await SQLClient(config) or .then().","message":"SQLClient is async and returns a promise","severity":"breaking","affected_versions":">=2.0"},{"fix":"Map typical config fields to these exact keys.","message":"Config property names differ from common SQL libraries: use name, username, password, hostName","severity":"gotcha","affected_versions":"all"},{"fix":"Wrap calls in try/catch or use .catch().","message":"No error handling in basic usage; DBWrite/DBRead may throw on query failure","severity":"gotcha","affected_versions":"all"},{"fix":"Review source code on GitHub for behavior details.","message":"Package documentation is minimal; no clear migration path or release notes","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"search_vec":"'2.2.54':21 'adopt':73 'aim':60 'checkdatabaseconnect':38 'communiti':72 'compar':52 'configur':63 'connect':11 'current':17 'databas':16 'dbread':36 'dbwrite':35 'document':70 'esm':48 'esm-on':47 'function':28 'helper':39 'import':50 'javascript':74 'librari':54 'lightweight':7 'like':55 'limit':69 'microsoft':13 'minim':62 'mssql':56 'node.js':8 'nodeash':1,3 'packag':9,23 'pattern':51 'promis':32 'provid':24 'rapid':65 'resolv':33 'return':30 'server':15 'setup':66 'ship':41 'simpl':26 'sql':2,4,14 'sqlclient':27 'stabl':18 'tedious':58 'type':43 'typescript':42,75 'use':45 'version':19","created_at":"2026-06-05T16:59:58.614636+00:00","updated_at":"2026-06-05T16:59:58.614636+00:00","problems":[{"fix":"Ensure database server is running and config keys/values are correct. Check that SQLClient is awaited.","cause":"SQLClient did not resolve to an object with those keys, likely due to wrong config or database connection failure.","error":"TypeError: Cannot destructure property 'DBWrite' of (intermediate value) as it is undefined."},{"fix":"Use import statement: import { SQLClient } from 'nodeash-sql';","cause":"CommonJS require used instead of ES import.","error":"ReferenceError: require is not defined in ES module scope"},{"fix":"Use named import: import { SQLClient } from 'nodeash-sql';","cause":"Default import used instead of named import.","error":"TypeError: SQLClient is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/akhilxyz/nodeash/tree/nodeash-sql#readme","github":"https://github.com/akhilxyz/nodeash#nodeash-sql","docs":null,"changelog":null,"pypi":null,"npm":"nodeash-sql","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}