Registry / database / epic-sql-query

epic-sql-query

JSON →
library1.2.23jsnpmunverified

epic-sql-query (v1.2.23) is a SQL query builder for Node.js and browser environments. It provides a fluent API to construct SELECT, INSERT, UPDATE, DELETE queries programmatically. Released with moderate cadence, it supports basic query building but may lack advanced features like subqueries or JOINs found in alternatives like knex.js. Note that this package has low download counts and minimal community involvement; consider evaluating its completeness before adopting in production.

npm install epic-sql-query
INSTALL
IMPORT
SIG · EPIC-SQL-QUERY
E
epic-sql-query
databasejavascriptv1.2.23
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.

EpicSQL
import { EpicSQL } from 'epic-sql-query'
const EpicSQL = require('epic-sql-query')
Package ships ESM modules. For CommonJS, use dynamic import or ensure your environment supports ESM.
QueryBuilder
import { QueryBuilder } from 'epic-sql-query'
Default export is EpicSQL; QueryBuilder may be used for more granular control.
default import
import epic from 'epic-sql-query'
const epic = require('epic-sql-query')
Package does not have a default export; named import is required.
TypeScript types
import type { EpicSQLType } from 'epic-sql-query'
import { EpicSQLType } from 'epic-sql-query'
Types are exported separately. Use `import type` to avoid bundling runtime code.

Demonstrates basic CRUD operations: SELECT, INSERT, UPDATE, DELETE using fluent API and obtaining SQL with parameterized bindings.

import { EpicSQL } from 'epic-sql-query'; const db = new EpicSQL({ client: 'sqlite3', connection: { filename: ':memory:' } }); // Build a SELECT query const query = db.select('users') .where('age', '>', 18) .orderBy('name', 'asc') .limit(10) .toSQL(); console.log(query.sql); // "SELECT * FROM users WHERE age > ? ORDER BY name ASC LIMIT ?" console.log(query.bindings); // [18, 10] // Insert const insert = db.insert('users', { name: 'John', age: 25 }).toSQL(); console.log(insert.sql); // "INSERT INTO users (name, age) VALUES (?, ?)" // Update const update = db.update('users', { age: 26 }).where('id', 1).toSQL(); console.log(update.sql); // "UPDATE users SET age = ? WHERE id = ?" // Delete const del = db.delete('users').where('id', 1).toSQL(); console.log(del.sql); // "DELETE FROM users WHERE id = ?"
Debug
Known issues
gotchaThe package does not support JOINs or subqueries. Attempting to use them will result in unexpected behavior or errors.
fix
Use knex.js or another advanced builder for complex queries.
affects: >=1.0.0
gotchaMethods like `.select()` return a QueryBuilder instance; you must call `.toSQL()` to get the final SQL string. Forgetting will cause runtime errors.
fix
Always chain `.toSQL()` at the end of a query pipeline.
affects: >=1.0.0
deprecatedThe `.raw()` method is deprecated in v1.2.0+ and will be removed.
fix
Use template literals with placeholders instead: `db.raw('SELECT ?', [value])`.
affects: >=1.2.0
breakingIn v1.2.0, the output of `.toSQL()` changed from an object with `text` and `values` to `sql` and `bindings`. Old code referencing `.text` or `.values` will break.
fix
Update references to `.sql` and `.bindings` respectively.
affects: >=1.2.0
Errors
Common errors & fixes
TypeError: epic_sql_query_1.default is not a function
Package does not have a default export; using default import incorrectly.
fix
Use named import: `import { EpicSQL } from 'epic-sql-query'`.
Cannot find module 'epic-sql-query'
Package not installed or ESM require without proper setup.
fix
Install: `npm install epic-sql-query`. For CommonJS, use dynamic import: `const epic = await import('epic-sql-query')`.
queryBuilder.toSQL is not a function
.toSQL() called on wrong object; likely chaining not completed.
fix
Ensure you call .toSQL() on the final QueryBuilder, e.g., `const sql = db.select('table').where('id',1).toSQL();`
Error: Raw query is deprecated. Use template literals.
Using deprecated .raw() method.
fix
Use `db.raw('SELECT ?', [value])` instead of `.raw()`.
Upgrade
Version history
1.2.23latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
epic-sql-query — npm install epic-sql-query · libregistry