Registry / database / alasql

alasql

JSON →
library4.17.3jsnpmunverified

AlaSQL (v4.17.3) is an open-source JavaScript SQL database for in-memory data processing, ETL, and browser/Node.js/mobile apps. It supports querying JavaScript arrays, objects, Excel (XLS/XLSX), CSV, JSON, IndexedDB, LocalStorage, and SQLite files with SQL-99 syntax and NoSQL extensions. Over 650k monthly downloads, weekly releases on npm. Key differentiators: direct query on nested JSON, relational joins across heterogeneous data sources, and no server required. Ships TypeScript types and works with ESM, CJS, and browser script tags.

npm install alasql
INSTALL
IMPORT
SIG · ALASQL
A
alasql
databasejavascriptv4.17.3
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.

alasql
import alasql from 'alasql'
const alasql = require('alasql')
Default import is the library instance. ESM-only since v4? (check package.json exports). CommonJS require may work with older versions or bundlers.
Database
import { Database } from 'alasql'
Named export for creating a new database instance (not the global alasql). Available from v4+? Check docs.
default
const alasql = require('alasql')
import * as alasql from 'alasql'
For CJS environments, require returns the default export. Wildcard import may give a module namespace object instead.

Demonstrates creating an in-memory relational table, inserting data, and querying with async/await. Uses TypeScript for strict type safety.

import alasql from 'alasql'; // Create table and insert data await alasql.promise('CREATE TABLE cities (city string, pop number)'); await alasql.promise("INSERT INTO cities VALUES ('Paris',2249975),('Berlin',3517424),('Madrid',3041579)"); // Query and get results const res = await alasql.promise('SELECT * FROM cities WHERE pop < 3500000 ORDER BY pop DESC'); console.log(res); // [ { city: 'Madrid', pop: 3041579 }, { city: 'Paris', pop: 2249975 } ]
Debug
Known issues
breakingalasql API changed from synchronous to promise-based in v4. Use alasql.promise() for async queries.
fix
Replace alasql('query') with await alasql.promise('query') or use callback version.
affects: >=4.0.0
deprecatedalasql.utils and some internal APIs are deprecated and may be removed in future versions.
fix
Avoid using undocumented properties. Use public SQL API instead.
affects: >=4.0.0
gotchaalasql executes SQL synchronously by default, which can block the event loop in Node.js and browsers.
fix
Use alasql.promise() for non-blocking execution, or wrap in a timeout/setImmediate.
affects: <4.0.0
Errors
Common errors & fixes
alasql is not a function
Importing the default export incorrectly (e.g., import * as alasql from 'alasql').
fix
Use `import alasql from 'alasql'` or `const alasql = require('alasql')`.
Cannot read property 'promise' of undefined
Using alasql.promise on older version (<4) that doesn't have it.
fix
Update to v4+ or use synchronous alasql('query') directly.
Upgrade
Version history
4.17.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
28 hits · last 30 days
node
24
OpenAI (training)
1
Resources
packagealasql
alasql — npm install alasql · libregistry