Registry / database / jl-sql-api

jl-sql-api

JSON →
library2.8.1jsnpmunverified

Stream-based SQL query engine for JavaScript objects, v2.8.1 (latest). Enables SELECT, UPDATE, DELETE, INSERT on Node.js object streams with support for infinite streams, external sorting via Unix sort, GROUP BY, JOIN (INNER/LEFT), and type casting. Unlike in-memory libraries, it processes large datasets without loading entirely into memory. Key differentiators: stream-native API, MySQL-like SQL dialect without FROM clause, JOIN syntax using '@table' notation, and support for JSON streams, arrays, and custom formats.

npm install jl-sql-api
INSTALL
IMPORT
SIG · JL-SQL-API
J
jl-sql-api
databasejavascriptv2.8.1
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.

JlSqlApi
const JlSqlApi = require('jl-sql-api');
import JlSqlApi from 'jl-sql-api';
Package uses CommonJS; no default export. Use require(). ESM support not available.
JlSqlApi
const { JlSqlApi } = require('jl-sql-api');
Named export also works with destructuring require.
query
const api = new JlSqlApi(); api.query('SELECT ...');
JlSqlApi.query(...) without new
JlSqlApi must be instantiated. Static method not available.

Demonstrates instantiation, query with GROUP BY and aggregation, piping from a readable stream to an array.

const JlSqlApi = require('jl-sql-api'); const api = new JlSqlApi(); // Create a simple read stream with objects const { Readable } = require('stream'); const input = Readable.from([ { type: 'fruit', qty: 3 }, { type: 'vegetable', qty: 5 }, { type: 'fruit', qty: 2 } ]); api.query('SELECT type, SUM(qty) AS total GROUP BY type') .fromJsonStream(input) .toArrayOfObjects(results => { console.log(results); // Output: [ { type: 'fruit', total: 5 }, { type: 'vegetable', total: 5 } ] });
Debug
Known issues
gotchaPackage does not support ESM imports; only CommonJS require().
fix
Use require() instead of import. No ESM wrapper available.
affects: >=0.0.0
gotchaFROM clause is not supported; input stream is provided via API methods (fromJsonStream, fromArrayOfObjects, etc.).
fix
Do not include FROM in SQL queries. Use .from*() methods to supply data.
affects: >=0.0.0
breakingNode.js engine requirement >=6; older versions not supported.
fix
Update Node.js to version 6 or later.
affects: >=2.0.0
gotchaSQL syntax uses MySQL-like dialect but lacks many features (no subqueries, no UNION, limited JOIN types).
fix
Refer to documentation for supported SQL subset. Avoid subqueries and complex joins.
affects: >=0.0.0
gotchaFor large GROUP BY or ORDER BY, external sorting may use unix sort utility which can write to disk; ensure sort utility is available in PATH.
fix
Install coreutils if missing (Linux/macOS). On Windows, consider using WSL or avoid large sorts.
affects: >=0.0.0
Errors
Common errors & fixes
SyntaxError: Unexpected token, expected "|"
Using ES6 import syntax instead of CommonJS require
fix
Replace import statement with const JlSqlApi = require('jl-sql-api');
TypeError: Cannot read property 'query' of undefined
Using the constructor without new: JlSqlApi() instead of new JlSqlApi()
fix
Instantiate with new: const api = new JlSqlApi();
Error: Node must be >= 6
Running on an older Node.js version
fix
Upgrade Node.js to version 6 or later.
Error: Unknown column 'someField' in 'field list'
SQL references a field that doesn't exist in the object stream
fix
Check object keys: ensure the field name matches exactly (case-sensitive).
Error: Called .fromJsonStream() with non-stream argument
Passed an array or other non-stream type to fromJsonStream
fix
Use fromArrayOfObjects() for arrays, or wrap array in Readable.from().
Upgrade
Version history
2.8.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
jl-sql-api — npm install jl-sql-api · libregistry