Registry / database / simple-sql-parser

simple-sql-parser

JSON →
library2.0.0-alpha.1jsnpmunverified

A JavaScript library for parsing CRUD (Create, Retrieve, Update, Delete) SQL queries into an AST. Currently at version 2.0.0-alpha.1 with sporadic maintenance. Supports basic SELECT, INSERT, UPDATE, DELETE statements. Limited documentation and unmaintained since 2014; alternative libraries like 'sql-parser' or 'node-sql-parser' are more robust. For legacy projects only.

npm install simple-sql-parser
INSTALL
IMPORT
SIG · SIMPLE-SQL-PARSER
S
simple-sql-parser
databasejavascriptv2.0.0-alpha.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.

parse
import { parse } from 'simple-sql-parser';
import parse from 'simple-sql-parser';
Function export is named; no default export.
SqlQuery
import { SqlQuery } from 'simple-sql-parser';
const { SqlQuery } = require('simple-sql-parser');
CommonJS require works, but type definition may be missing.
SqlNode
import type { SqlNode } from 'simple-sql-parser';
import { SqlNode } from 'simple-sql-parser';
SqlNode is an interface for TypeScript users; prefer type import.

Parses a SELECT SQL query into an AST structure showing columns, tables, where clause, and ordering.

import { parse } from 'simple-sql-parser'; const query = 'SELECT id, name FROM users WHERE age > 18 ORDER BY name DESC'; const ast = parse(query); console.log(JSON.stringify(ast, null, 2)); // Output includes: type, columns, from, where, order
Debug
Known issues
deprecatedsimple-sql-parser is abandoned; last release in 2014 and repository archived.
fix
Migrate to actively maintained alternatives like node-sql-parser.
affects: >=1.0.0
gotchaThe library only supports basic CRUD; JOIN, subqueries, and complex expressions may throw errors.
fix
Pre-validate SQL or use a more comprehensive parser.
affects: >=0.0.1
breakingVersion 2.0.0-alpha.1 has breaking API changes from v1 but no documentation.
fix
Check source code on GitHub for API usage.
affects: 2.0.0-alpha.1
gotchaNo TypeScript type definitions bundled; types must be manually written.
fix
Define own interfaces or use a parser with built-in types.
affects: *
Errors
Common errors & fixes
TypeError: parse is not a function
Using default import instead of named import.
fix
import { parse } from 'simple-sql-parser';
Cannot find module 'simple-sql-parser'
Package not installed or path issue in Node.js.
fix
npm install simple-sql-parser@2.0.0-alpha.1
Error: Not implemented: UNION
Library does not support UNION queries.
fix
Use a more complete SQL parser like 'node-sql-parser'.
Upgrade
Version history
2.0.0-alpha.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
6
Meta
2
Resources