Registry / database / node-fast-sql

node-fast-sql

JSON →
library1.0.16jsnpmunverified

A MySQL query builder for Node.js that automatically introspects database schema on connection, providing chainable table, column, and row operations for SELECT, INSERT, UPDATE, DELETE. Version 1.0.16 is stable but rarely updated. Unlike knex or Sequelize, it requires an active MySQL connection and relies on schema reflection, making it lightweight but tightly coupled to a single database. Suitable for quick scripts but lacks migration, pooling, or type safety. Use with caution in production.

npm install node-fast-sql
INSTALL
IMPORT
SIG · NODE-FAST-SQL
N
node-fast-sql
databasejavascriptv1.0.16
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.

default
const Mysql = require('node-fast-sql')
import Mysql from 'node-fast-sql' // not ESM, use require
Package uses CommonJS; no default export for ESM.
Mysql
const Mysql = require('node-fast-sql')
const { Mysql } = require('node-fast-sql') // incorrect, default is a constructor
Import the constructor directly from require.
new Mysql(config)
new Mysql({ host, user, password, database, port })
new Mysql(config, callback) // no callback; use async/await
Requires MySQL config object; constructor does not accept a callback.

Shows connecting to MySQL, building a SELECT query with filter, executing it, and releasing the connection.

const Mysql = require('node-fast-sql'); const config = { host: 'localhost', user: 'root', password: process.env.MYSQL_PASSWORD ?? '', database: 'workbench', port: 3306 }; const mysql = new Mysql(config); async function run() { await mysql.waitConnect(); const table = mysql.getTable('order'); const col = table.getColumn('id'); table.row.filter(col.equal(504)); table.showColumns('id', 'number'); const sql = table.select(); console.log(sql); const conn = await mysql.getConnect(); const result = await conn.queryOnce(sql); console.log(result); conn.release(); mysql.closeConnect(); } run().catch(console.error);
Debug
Known issues
gotchaMust call waitConnect() before using any table methods; otherwise getTable() may return undefined or incomplete schema.
fix
Await mysql.waitConnect() before any other calls.
affects: >=1.0.0
gotchaconn.queryOnce() and conn.query() are custom methods on the connection object, not standard mysql driver methods. Using standard mysql connection.query() will fail.
fix
Use conn.queryOnce(sql) or conn.query(sql) as provided by node-fast-sql.
affects: >=1.0.0
gotchagetTable() uses schema introspection; if the table doesn't exist or has no columns, subsequent calls fail silently.
fix
Ensure table exists and waitConnect() completes before accessing it.
affects: >=1.0.0
gotchaNo TypeScript definitions; only plain JS usage is supported.
fix
Use JSDoc or hand-roll types if needed.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read property 'filter' of undefined
table.row is undefined because waitConnect() not called or failed.
fix
Add await mysql.waitConnect() before accessing table methods.
Error: ER_NO_SUCH_TABLE: Table 'database.table' doesn't exist
getTable() called with a table name that doesn't exist in the database.
fix
Check table name and ensure waitConnect() completed; database may need migration.
Error: Cannot find module 'mysql'
The mysql driver is not installed as a dependency; node-fast-sql lists it as a peer dependency but does not install it automatically.
fix
Run: npm install mysql
Upgrade
Version history
1.0.16latest on npm
Audit
Dependencies
mysqlrequiredMySQL driver used internally; must be installed separately
Agent activity
2 hits · last 30 days
node
2
Resources
node-fast-sql — npm install node-fast-sql · libregistry