moz-sql-parser
Extract Parse Tree from SQL
Decision gist · record as of 2026-08-14
Yes, if you need basic SQL parsing to JSON and can tolerate an aging codebase. The package has no dependencies, handles common SELECT patterns, and has been stable for years. However, install only if you do not require support for advanced SQL dialects or expect active maintenance; the latest release is from May 2021 and the project is classified as aging. The copyleft MPL 2.0 license requires source disclosure if you modify and redistribute.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Python recursion limit may need adjustment for large or deeply nested SQL queries; the default limit may be insufficient.
- High install friction: the package has not been updated since May 2021 and is classified as aging.
- The last commit was in October 2025, but the latest release is nearly five years old, suggesting maintenance is minimal or stalled.
License · maintenance · safety
MPL 2.0 (copyleft) — Licensed under Mozilla Public License 2.0 (MPL 2.0), a copyleft license. You must disclose source code modifications and distribute under the same license if you modify and distribute the package; this may constrain commercial or proprietary use.
last release 2021-05-06 (1926 days) · last repo commit 2025-10-28 · 294 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 111,380 downloads/mo, #12,418 on PyPI
Alternatives
Verify before relying
from moz_sql_parser import parse
import json
result = parse("select a, b from jobs where a > b")
print(json.dumps(result))- Whether the parser handles modern SQL dialects (BigQuery, Redshift, etc.) beyond basic SELECT—the description notes these are still missing.
- Current state of test coverage and whether the tests mentioned have been maintained or expanded.
- Whether the formatter (SQL generation from JSON) is production-ready or remains incomplete.
What it is and what it does
Moz SQL Parser converts SQL SELECT queries into JSON-serializable parse trees, where each SQL clause becomes a named object property and expressions are represented as operation-parameter pairs. It also provides a formatter to generate SQL from JSON objects, though that feature remains incomplete. The parser originally targeted MySQL but has expanded to other vendors; it handles basic queries, subqueries, WITH clauses, and window functions, but does not support UPDATE or INSERT statements or provide data access tools.
The package is designed to let non-SQL datastores expose a familiar SQL interface to users, with the expectation that developers will convert the resulting JSON parse trees into native queries for their backend. It has no runtime dependencies, making installation straightforward, but the codebase is aging—the latest release is from May 2021 and maintenance appears minimal despite recent repository activity.
Use it for
- Convert SQL queries to JSON for analysis, validation, or transformation in a custom query engine or datastore adapter.
- Build a SQL-to-native-query translator that accepts SQL input and generates backend-specific queries from the parse tree.
- Analyze SQL query structure programmatically to extract table names, columns, or filter conditions.
- Provide a SQL interface to non-relational datastores by parsing user queries and mapping them to native APIs.
- Generate SQL statements from JSON configuration objects for dynamic query construction.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need basic SQL parsing to JSON and can tolerate an aging codebase.
The package has no dependencies, handles common SELECT patterns, and has been stable for years. However, install only if you do not require support for advanced SQL dialects or expect active maintenance; the latest release is from May 2021 and the project is classified as aging. The copyleft MPL 2.0 license requires source disclosure if you modify and redistribute.
Install
moz-sql-parser on PyPI
Before you install
High install friction: the package has not been updated since May 2021 and is classified as aging. The last commit was in October 2025, but the latest release is nearly five years old, suggesting maintenance is minimal or stalled.
Python recursion limit may need adjustment for large or deeply nested SQL queries; the default limit may be insufficient.
License in practice
Licensed under Mozilla Public License 2.0 (MPL 2.0), a copyleft license. You must disclose source code modifications and distribute under the same license if you modify and distribute the package; this may constrain commercial or proprietary use.
Quickstart
from moz_sql_parser import parse
import json
result = parse("select a, b from jobs where a > b")
print(json.dumps(result))
Verify before relying
- Whether the parser handles modern SQL dialects (BigQuery, Redshift, etc.) beyond basic SELECT—the description notes these are still missing.
- Current state of test coverage and whether the tests mentioned have been maintained or expanded.
- Whether the formatter (SQL generation from JSON) is production-ready or remains incomplete.
Package facts
| License | MPL 2.0 copyleft |
| Python support | Not specified |
| Install friction | High. Source build required |
| Runtime dependencies | None |
| Maintenance | Aging 1,926 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 111,380 / month, #12,418 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaLicense :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)Programming Language :: Python :: 3.7Programming Language :: SQLTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules |
Evidence: moz-sql-parser-4.40.21126.tar.gz
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “parse sql queries”
- moz-sql-parserParses SQL queries into JSON-serializable parse trees, and can…
- mo-sql-parsingParses SQL queries into JSON-serializable parse trees, and can…
- sqlparsesqlparse tokenizes SQL text into a tree of statements, clauses, and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also mo-sql-parsing · gw-dsl-parser · sqlparse · scim2-filter-parser · sqloxide · vanna · sqlvalidator · sql-formatter · py-partiql-parser · cql2