--- id: mo-sql-parsing version: "11.697.25301" license: MPL 2.0 license_treatment: copyleft maintenance: aging --- # mo-sql-parsing — More SQL Parsing! Parse SQL into JSON parse tree License: copyleft · Maintenance: aging · Downloads: 204.4K/mo ## What it is and what it does mo-sql-parsing converts SQL queries into JSON objects where each SQL clause becomes a named property. The parser originally targeted MySQL but now supports multiple database engines including SQLServer (with bracket identifiers) and BigQuery (with array syntax). It handles complex queries including subqueries, WITH clauses, window functions, CREATE/DROP/ALTER statements, and basic DML (INSERT/UPDATE/DELETE), with limited UDF support. The package also works in reverse: you can generate SQL from a JSON parse tree using the format function. It offers multiple parsing modes—parse_mysql for double-quoted strings, parse_sqlserver for bracket identifiers, and options to customize NULL representation and function call format (simple operator vs. normalized). The output is designed to be JSON-serializable, making it suitable for downstream translation to other datastores or query engines. Use it for: - Translate SQL queries between different database systems by parsing to JSON and regenerating for the target dialect - Build query analysis tools that inspect SQL structure programmatically via JSON representation - Convert SQL to alternative query languages or intermediate representations for query optimization - Validate or normalize SQL syntax by parsing and reformatting through the JSON layer - Extract metadata from SQL (table names, column references, join conditions) by traversing the parse tree ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses SQL queries into JSON-serializable parse trees, and can generate SQL back from JSON, supporting multiple database flavors including MySQL, SQLServer, and BigQuery. Yes, if you need to parse SQL into a structured, JSON-friendly format for cross-database translation or query analysis. The package is stable (Production/Stable status) with broad Python version support and no known vulnerabilities. The aging maintenance status (290 days since last release) is a minor concern for active development, but the repository remains responsive to issues. The MPL 2.0 copyleft license requires disclosure of modifications. Install friction is low. ## Install pip install mo-sql-parsing uv add mo-sql-parsing poetry add mo-sql-parsing ## Installing mo-sql-parsing Before you install: Low install friction with a pure-Python wheel and four lightweight runtime dependencies. Maintenance is aging—last release was 290 days ago—but the repository remains active with ongoing issue resolution and over 1200 tests covering most SQL dialects. License in practice: Licensed under MPL 2.0 (copyleft). You must disclose source modifications and distribute under the same license if you modify the package; using it unmodified in a closed-source application is permitted. Quickstart: pip install mo-sql-parsing from mo_sql_parsing import parse result = parse("select count(1) from jobs") # Output: {'select': {'value': {'count': 1}}, 'from': 'jobs'} Verify before relying: - Whether the parser handles all SQL edge cases in your specific database dialect without manual workarounds - Performance characteristics when parsing very large or deeply nested queries ## Package facts - License: MPL 2.0 (copyleft) - Python support: unspecified - Install friction: low - Maintenance: aging - Downloads: 204.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sql parser json, convert sql to json, sql query parsing, sql ast generator, sql to json tree, parse sql statements, sql dialect parser, sql-parsing, query-translation, json-serialization [View on SkillFed](https://skillfed.io/packages/mo-sql-parsing) · [View on PyPI](https://pypi.org/project/mo-sql-parsing/)