Registry / database / liqd-sql

liqd-sql

JSON →
library1.6.2jsnpmunverified

liqd-sql is a Node.js SQL connector supporting MySQL, SQL Server, and Oracle databases. Version 1.6.2 (stable) provides a fluent query builder API for CRUD operations, table creation, joins, unions, and transactions. It returns standardized result objects with metadata like affected rows and execution time. Unlike ORMs, it offers a lightweight, promise-based approach with low overhead. The package is maintained on GitHub and Travis CI, licensed under MIT.

npm install liqd-sql
INSTALL
IMPORT
SIG · LIQD-SQL
L
liqd-sql
databasejavascriptv1.6.2
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.

default
import SQL from 'liqd-sql';
const SQL = require('liqd-sql');
Package is ESM-only; use import or const SQL = new (require('liqd-sql').default)(config);
SQL
const SQL = new (require('liqd-sql'))({ mysql: { ... } });
const SQL = require('liqd-sql');
The module exports a class; instantiate with config to connect.
.query()
const result = await SQL.query('users').select();
const result = SQL.query('users').select();
All query methods return promises; use await or .then()

Connects to MySQL, creates a users table, inserts a row, and selects all rows.

const SQL = new (require('liqd-sql'))({ mysql: { host: 'localhost', user: 'root', password: process.env.MYSQL_PASSWORD ?? '', database: 'test' } }); await SQL.query({ columns: { id: { type: 'BIGINT:UNSIGNED', increment: true }, name: { type: 'VARCHAR:255' }, surname: { type: 'VARCHAR:255' }, cityID: { type: 'BIGINT:UNSIGNED' } }, indexes: { primary: 'id', unique: [], index: ['city'] } }, 'users').create_table(true); await SQL.query('users').insert({ name: 'John', surname: 'D.', cityID: 1 }); let data = await SQL.query('users').select(); console.log(data);
Debug
Known issues
breakingESM-only since v1.6.0 - requires Node.js >=12 and 'type': 'module' in package.json
fix
Use import instead of require(); for CommonJS, use dynamic import()
affects: >=1.6.0
deprecatedSupport for Oracle and SQL Server is experimental and may break in future releases.
fix
Test thoroughly; consider using dedicated drivers for production Oracle/SQL Server
affects: >=1.0.0
gotchaResults include 'row' and 'rows' properties; selecting a single row returns both, but 'rows' is always an array
fix
Use .row for single row results; .rows for arrays
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'liqd-sql'
Package not installed or incorrect import path
fix
Run 'npm install liqd-sql' and use correct import: import SQL from 'liqd-sql'
SQL is not a constructor
Using require('liqd-sql') without default property in ESM mode
fix
Use const SQL = new (require('liqd-sql').default)(config); or use import
Cannot read property 'query' of undefined
Failed to instantiate SQL with valid config
fix
Ensure config object has correct driver key (mysql/mssql/oracle) and valid connection details
Upgrade
Version history
1.6.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
liqd-sql — npm install liqd-sql · libregistry