Registry / database / sqlmath

sqlmath

JSON →
library2026.4.31jsnpmunverified

sqlmath is an SQLite extension providing data science superpowers: 500+ built-in SQL functions for statistics, machine learning (via LightGBM), signal processing, compression, cryptography, and arrays. Current stable version is v2026.4.31, released monthly. Unlike other SQL analytics tools, sqlmath runs fully in-browser via WebAssembly or as a Node.js / Python library, with zero server dependencies. It includes a live web demo at sqlmath.github.io.

npm install sqlmath
INSTALL
IMPORT
SIG · SQLMATH
S
sqlmath
databasejavascriptv2026.4.31
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.

initSqlMath
import { initSqlMath } from 'sqlmath'
const sqlmath = require('sqlmath')
ESM only; no CommonJS support. Must call initSqlMath with a SQL.js database instance.
sqlmath
const initSqlMath = require('sqlmath').initSqlMath
const sqlmath = require('sqlmath')
In Node.js, use dynamic import or require('sqlmath').initSqlMath. Default export is not available in CJS.
SqlMathWasm
import { SqlMathWasm } from 'sqlmath/wasm'
import { SqlMathWasm } from 'sqlmath'
WASM module is exported from 'sqlmath/wasm' subpath. The main entry does not include it.

Shows how to initialize sqlmath with sql.js, create a table, insert data, and run aggregate statistical functions.

import initSqlJs from 'sql.js'; import { initSqlMath } from 'sqlmath'; async function run() { const SQL = await initSqlJs(); const db = new SQL.Database(); initSqlMath(db); db.run("CREATE TABLE data (x REAL, y REAL)"); db.run("INSERT INTO data VALUES (1, 2), (3, 4), (5, 6)"); const res = db.exec("SELECT AVG(x), STDEV_SAMP(y) FROM data"); console.log(res[0].values); } run();
Debug
Known issues
breakingThe function STDEV_SAMP has been renamed to STDDEV_SAMP in v2026.4.0.
fix
Use STDDEV_SAMP instead of STDEV_SAMP.
affects: <2026.4.0
deprecatedThe 'sqlmath/crypto' subpackage is deprecated since v2026.3.0; cryptographic functions are now in the main bundle.
fix
Remove separate import 'sqlmath/crypto'. All crypto functions are now available after initSqlMath().
affects: >=2026.3.0
gotchaWhen using WebWorker, initSqlMath must be called inside the worker after loading sql.js.
fix
Ensure sql.js and sqlmath are loaded in the worker thread, then call initSqlMath(db) on the worker's database.
affects: >=2026.1.0
Errors
Common errors & fixes
TypeError: initSqlMath is not a function
Trying to import the default export instead of named export.
fix
Use import { initSqlMath } from 'sqlmath'
Error: sqlmath requires a sql.js database instance
Calling initSqlMath without passing a valid database object.
fix
Pass an instance of SQL.Database from sql.js: const db = new SQL.Database(); initSqlMath(db);
Upgrade
Version history
2026.4.31latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
17 hits · last 30 days
node
14
Meta
1
OpenAI (training)
1
Resources
sqlmath — npm install sqlmath · libregistry