Registry / database / skwell

skwell

JSON →
library12.1.0jsnpmunverified

Skwell is a promised-based SQL Server client for Node.js with built-in connection pooling. Version 12.1.0 is the latest stable release. It provides a simple API for executing queries, stored procedures, bulk loads, and streaming results. Key differentiators include automatic connection pooling, parameter expansion for arrays, and event-based error handling. Released under the MIT license.

npm install skwell
INSTALL
IMPORT
SIG · SKWELL
S
skwell
databasejavascriptv12.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

connect
import skwell from 'skwell'; const sql = skwell.connect({...})
const { connect } = require('skwell');
The default export is the 'skwell' object; require('skwell') returns the default. Named export 'connect' is not available.
sql types
const sql = skwell.connect({...}); // then use sql.nvarchar, sql.int, etc.
const { nvarchar } = require('skwell');
Type constructors are properties on the connected client instance, not direct exports.
query/execute etc
const sql = skwell.connect({...}); const rows = await sql.query('SELECT * FROM table');
const { query } = require('skwell'); query('SELECT...')
Query methods are instance methods on the client returned by skwell.connect().

Connects to SQL Server with environment variables, runs a simple SELECT, and disconnects.

import skwell from 'skwell'; const sql = skwell.connect({ username: process.env.DB_USER ?? 'sa', password: process.env.DB_PASS ?? 'password', server: process.env.DB_SERVER ?? 'localhost', database: process.env.DB_NAME ?? 'test', port: 1433, pool: { min: 1, max: 10 }, connectTimeout: 15000, requestTimeout: 15000, encrypt: false }); const users = await sql.query('SELECT * FROM Users'); console.log(users); await sql.close();
Debug
Known issues
gotchaThe default export is a function that requires a config object. Passing no arguments or invalid config will throw.
fix
Always provide a valid config object with at least username, password, server, and database.
affects: >=1.0.0
deprecatedThe 'queryStream' method returns a stream of objects; the stream must be consumed fully or properly closed to release the connection.
fix
Ensure you call .destroy() on the stream or use it within a 'for await...of' loop.
affects: >=12.0.0
gotchaSetting 'pool: false' disables pooling entirely. Not setting 'pool' enables default pooling.
fix
If you want pooling, omit 'pool' or set 'pool' to an object with min/max.
affects: >=1.0.0
gotchaParameter expansion for arrays: an empty array expands to 'SELECT 1 WHERE 1=0', which may cause unexpected empty results.
fix
Check for empty arrays before passing to avoid unintended empty set logic.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: skwell.connect is not a function
Using named import 'connect' instead of default import.
fix
Use 'import skwell from 'skwell'' then 'skwell.connect()'.
Module parse failed: The keyword 'import' is reserved
Trying to use ESM import syntax in a CommonJS environment without transpilation.
fix
Use 'const skwell = require('skwell')' or set up Babel/TypeScript.
Error: Login failed for user '...'
Invalid credentials or server does not allow SQL Server authentication.
fix
Verify username/password and server configuration; consider using NTLM domain.
Upgrade
Version history
12.1.0latest on npm
Audit
Dependencies
mssqlrequiredSkwell is built on top of mssql and re-exports its types.
Agent activity
16 hits · last 30 days
node
14
Amazon
1
Resources
packageskwell
skwell — npm install skwell · libregistry