Registry / database / anydb-sql

anydb-sql

JSON →
library0.7.1jsnpmunverified

Minimal ORM supporting MySQL, PostgreSQL, and SQLite with full SQL query support. Version 0.7.1 is the latest stable release (no recent updates). Based on node-sql query builder and node-anydb connection pool. Key differentiator: allows arbitrary SQL while providing table definition and relationship helpers like selectDeep for nested results. Supports both callback and promise patterns. No TypeScript types shipped in vs 0.7.1.

npm install anydb-sql
INSTALL
IMPORT
SIG · ANYDB-SQL
A
anydb-sql
databasejavascriptv0.7.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.

anydbsql
import anydbsql from 'anydb-sql'
const anydbsql = require('anydb-sql')
Default import from CJS module; works with both import and require.
db
const db = anydbsql({url: '...'})
none
No named exports; only default export.
table
const user = db.define({name: 'users', columns: {id: {primaryKey: true}}})
none
Define tables using db.define.

Initialize anydb-sql, define a table, and run a simple get query with promises.

import anydbsql from 'anydb-sql'; const db = anydbsql({ url: process.env.DATABASE_URL ?? 'postgres://user:pass@localhost/mydb', connections: { min: 2, max: 20 } }); const user = db.define({ name: 'users', columns: { id: { primaryKey: true }, email: {}, name: {} } }); user.where({ email: 'test@example.com' }).get() .then(row => console.log(row)) .catch(err => console.error(err));
Debug
Known issues
deprecatedanydb-sql is unmaintained (last release 2015). Consider using Knex.js or Sequelize for active support.
fix
Migrate to Knex.js or Sequelize.
affects: >=0.0.1
gotchaNo TypeScript definitions in npm package; must provide own types.
fix
Write custom .d.ts or use @types/anydb-sql (if exists).
affects: >=0.0.1
gotchaConnection pool settings must be provided at init; cannot be changed later.
fix
Set pool options during initialization.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'anydb-sql'
Package not installed or incorrect path.
fix
Run npm install anydb-sql and ensure correct import path.
url is required
Missing 'url' property in config object.
fix
Provide a connection string like 'postgres://user:pass@host/db'.
TypeError: db.define is not a function
anydbsql() not called correctly.
fix
Use const db = anydbsql({...}) not const db = require('anydb-sql').
Upgrade
Version history
0.7.1latest on npm
Audit
Dependencies
any-dbrequiredConnection pool and query execution
sqlrequiredQuery builder (node-sql dependency)
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
anydb-sql — npm install anydb-sql · libregistry