# node-sqlparser

> a sql parser for node.js

Latest version **1.0.4** (published 2018-07-12) · GPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install node-sqlparser
pnpm add node-sqlparser
yarn add node-sqlparser
bun add node-sqlparser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-07-12 |
| First published | 2014-05-21 |
| Weekly downloads | 0 |
| License | GPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8.0 |
| Dependencies | 0 |
| Unpacked size | 255.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 385 |
| Author | windyrobin |
| Maintainers | fish |
| Keywords | sql parser, sql ast, custom sql |

## Links

- npm: https://www.npmjs.com/package/node-sqlparser
- Repository: https://github.com/alibaba/nquery
- Homepage: https://github.com/alibaba/nquery#readme
- Issues: https://github.com/alibaba/nquery/issues
- npm.io page: https://npm.io/package/node-sqlparser

## Recent versions

- 1.0.4 (latest) — 2018-07-12
- 1.0.2 — 2015-03-09
- 1.0.1 — 2015-02-14
- 1.0.0 — 2015-02-02
- 0.0.4 — 2014-06-17
- 0.0.3 — 2014-06-08
- 0.0.2 — 2014-06-03
- 0.0.1 — 2014-05-21

## README

node-sqlparser

======

node-sqlparser, write in javascript

## Install

NodeJS Version 0.8.0+

```
npm install node-sqlparser
```

## Introduction


for the test , type the command:

```
make test
```

## Usage


static function
```js
var sql = 'select * from tablea where field1 = 0';
var parse = require('node-sqlparser').parse;
var stringify = require('node-sqlparser').stringify;
var astObj = parse(sql);

var sqlstr = stringify(astObj);
```

using ast
```
var AST = require('node-sqlparser');

var ast = new AST();
ast.parse(sql);

ast.stringify();

```

## Acknowledgements

* PegJS     : http://pegjs.majda.cz/
* NodeJS    : http://nodejs.org/
* BigQuery  : https://developers.google.com/bigquery/docs/query-reference
* PL/SQL    : http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/fundamentals.htm#autoId0
* MySQL     : http://dev.mysql.com/doc/refman/5.1/en/sql-syntax.html
* Impala    : https://github.com/cloudera/impala/blob/master/fe/src/main/cup/sql-parser.y
* PgSQL     : http://www.postgresql.org/docs/9.2/interactive/sql-syntax.html
* ql.io     : http://ql.io

---
_Source: https://npm.io/package/node-sqlparser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
