Registry / database / sql-extra

sql-extra

JSON →
library0.1.13jsnpmunverified

Utility library providing helper functions for generating common SQL commands programmatically. Current version 0.1.13. Lightweight, no dependencies, supports PostgreSQL-specific features like tsquery. Offers methods like createTable, createIndex, insertInto, and tableExists. Suitable for Node.js applications needing dynamic SQL generation. Not actively maintained; last update in 2021.

npm install sql-extra
INSTALL
IMPORT
SIG · SQL-EXTRA
S
sql-extra
databasejavascriptv0.1.13
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.

extra
const extra = require('sql-extra')
import extra from 'sql-extra'
Package is CommonJS-only; ESM import will fail.
createTable
const { createTable } = require('sql-extra')
import { createTable } from 'sql-extra'
Use destructured require for named exports.
createIndex
const extra = require('sql-extra'); extra.createIndex(...)
const createIndex = require('sql-extra').createIndex
Alternative destructuring is fine; no TypeScript types.

Demonstrates generating a CREATE TABLE statement with options.

const extra = require('sql-extra'); const createTableSQL = extra.createTable( 'users', { id: 'INTEGER PRIMARY KEY', name: 'TEXT NOT NULL', email: 'TEXT UNIQUE' }, { ifNotExists: true } ); console.log(createTableSQL); // Output: CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT NOT NULL, email TEXT UNIQUE)
Debug
Known issues
gotchaMethod 'matchTsquery' only generates PostgreSQL tsquery; not compatible with other databases.
fix
Use only with PostgreSQL or replace with alternative.
affects: >=0.0.1
gotchaThe library does not escape column names; SQL injection risk if user input used.
fix
Sanitize column names manually before passing.
affects: >=0.0.1
deprecatedThe package has not been updated since 2021; consider using 'sql-bricks' or 'knex' for active maintenance.
fix
Migrate to a more maintained library like 'sql-bricks' or 'knex'.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'sql-extra'
Package not installed or missing from node_modules.
fix
Run: npm install sql-extra
TypeError: extra.createTable is not a function
Incorrect import or usage when using ES6 imports.
fix
Use require('sql-extra') instead of import.
Upgrade
Version history
0.1.13latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
14
Meta
1
OpenAI (training)
1
Resources
sql-extra — npm install sql-extra · libregistry