JSPM

  • Created
  • Published
  • Downloads 1098
  • Score
    100M100P100Q131881F
  • License MIT

Squirreling SQL Engine

Package Exports

  • squirreling
  • squirreling/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (squirreling) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Squirreling SQL Engine

squirreling engine

npm downloads minzipped workflow status mit license coverage dependencies

Squirreling is a streaming async SQL engine for JavaScript. It is designed to provide efficient streaming of results from pluggable backends for highly efficient retrieval of data for browser applications.

Features

  • Lightweight and fast
  • Easy to integrate with frontend applications
  • Lets you move query execution closer to your users
  • Supports standard SQL queries
  • Async streaming for large datasets
  • Constant memory usage for simple queries with LIMIT
  • Robust error handling and validation designed for LLM tool use
  • In-memory data option for simple use cases
  • Late materialization for efficiency
  • Select only

Usage

Squirreling returns an async generator, allowing you to process rows one at a time without loading everything into memory.

import { executeSql } from 'squirreling'

// In-memory table
const users = [
  { id: 1, name: 'Alice', active: true },
  { id: 2, name: 'Bob', active: false },
  { id: 3, name: 'Charlie', active: true },
  // ...more rows
]

// Process rows as they arrive (streaming)
for await (const { cnt } of executeSql({
  tables: { users },
  query: 'SELECT count(*) as cnt FROM users WHERE active = TRUE LIMIT 10',
})) {
  console.log('Count', cnt)
}

There is an exported helper function collect to gather all rows into an array if needed:

import { collect, executeSql } from 'squirreling'

const allUsers = await collect(executeSql({
  tables: { users },
  query: 'SELECT * FROM users',
}))
console.log(allUsers)