Socket
Book a DemoInstallSign in
Socket

@danscan/sqlite3-parser

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@danscan/sqlite3-parser

WebAssembly-compiled SQL parser for SQLite dialect with TypeScript support

0.1.2
latest
npmnpm
Version published
Maintainers
1
Created
Source

SQLite3 Parser

A type-safe bi-directional SQL parser / AST formatter for SQLite for TypeScript, backed by the rust crate sqlparser-rs, compiled to WebAssembly.

Features

  • Type-Safe: Full TypeScript definitions for AST structures
  • Bidirectional: SQL → AST and AST → SQL conversion
  • Fast: Rust compiled to WebAssembly for optimal performance
  • Complete: Supports many SQLite features, including complex queries and CTEs
  • Table Access Info: Get table access information (read vs write for each referenced table) from a SQL statement

Unsupported SQLite Features:

  • ATTACH/DETACH
  • PRAGMA

Installation

bun add @danscan/sqlite3-parser
npm add @danscan/sqlite3-parser
yarn add @danscan/sqlite3-parser

Usage

import { parseSQL, validateSQL, formatAST, getSQLAccessInfo, type Statement } from '@danscan/sqlite3-parser';

const sql = 'SELECT * FROM users';
const ast = parseSQL(sql);
const formattedSql = formatAST(ast);
const accessInfo = getSQLAccessInfo(sql);

API Reference

parseSQL(sql: string): Statement[]

Parse a SQL string into an AST.

validateSQL(sql: string): boolean

Returns whether the SQL string is valid.

formatAST(ast: Statement[] | Statement): string

Format an AST back into a SQL string.

getSQLAccessInfo(sql: string): TableAccessInfo

Get table access information (read vs write for each referenced table) from a SQL statement.

Keywords

sql

FAQs

Package last updated on 09 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.