Registry / data / moz-sql-parser

moz-sql-parser

JSON →
library4.40.21126pypypiunverified

Moz SQL Parser is a Python library to parse SQL queries and extract the parse tree as a JSON-like structure. Currently at version 4.40.21126, it is actively maintained and does not have a fixed release cadence.

pip install moz-sql-parser
INSTALL
IMPORT
SIG · MOZ-SQL-PARSER
M
moz-sql-parser
datapythonv4.40.21126
Install
6.6s avg
Import
505ms
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.40.21126 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.100s · 20.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 6.6s · import 0.102s · 21MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse
from moz_sql_parser import parse
from moz_sql_parser import parse_sql
parse_sql is the old name, still works but parse is preferred.
format
from moz_sql_parser import format

Parse a simple SQL query and print the AST.

from moz_sql_parser import parse sql = "SELECT a, b FROM table WHERE c > 1" result = parse(sql) print(result)
Debug
Known issues
gotchaThe parsed output is a nested dictionary with keys like 'select', 'from', 'where', etc. The structure may differ from expectations for complex SQL (e.g., JOINs, subqueries). Always inspect the output.
fix
Print or debug the output to understand the AST shape.
affects: all
deprecatedThe function 'parse_sql' has been renamed to 'parse'. 'parse_sql' still works but may be removed in future versions.
fix
Use 'from moz_sql_parser import parse' instead of 'parse_sql'.
affects: >=4.0.0
Upgrade
Version history
4.40.21126latest on PyPI · released May 6, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
moz-sql-parser — pip install moz-sql-parser · libregistry