simple-ddl-parser
Simple DDL Parser to parse SQL & dialects like HQL, TSQL (MSSQL), Oracle, AWS Redshift, Snowflake, MySQL, PostgreSQL, etc ddl files to json/python dict with full information about columns: types, defaults, primary keys, etc.; sequences, alters, custom types & other entities from ddl.
What it is and what it does
Simple DDL Parser is a Python library built on ply (Python's lex and yacc implementation) that converts SQL Data Definition Language statements into structured dictionaries or JSON. It supports multiple SQL dialects including HQL, MSSQL, Oracle, MySQL, PostgreSQL, BigQuery, Redshift, Snowflake, SparkSQL, IBM DB2, and others. The parser extracts detailed schema information—table names, column definitions with types and sizes, primary keys, constraints, defaults, and references—while preserving dialect-specific properties like partitioning and storage formats when requested.
The library is case-insensitive and designed to handle real-world DDL variations. It offers both a Python API for programmatic use and a command-line tool (sdp) for batch processing. Output can be customized via output_mode to include dialect-specific fields or reshaped into formats like BigQuery JSON schema. The maintainer actively adds support for new statements and dialects based on user requests and maintains functional test coverage.
Use it for:
- Extract table and column metadata from existing SQL databases to generate documentation or ERD diagrams.
- Convert DDL from one SQL dialect to another by parsing and reshaping output with custom schemas.
- Validate and normalize DDL statements programmatically in data pipeline or schema migration tools.
- Parse Hive or BigQuery DDL to extract partition, storage, and location metadata for data lake management.
- Generate Python ORM models or database client code from DDL definitions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses SQL DDL statements and their dialect variants into structured Python dictionaries or JSON, extracting table schemas, columns, constraints, and dialect-specific properties.
Yes. The package is actively maintained, has no known vulnerabilities, installs with minimal friction, and is widely used. It solves a real problem—parsing diverse SQL dialects into structured data—with a permissive MIT license. Install it if you need to programmatically extract or transform SQL schema definitions.
Install
simple-ddl-parser on PyPI
pip
pip install simple-ddl-parseruv
uv add simple-ddl-parserpoetry
poetry add simple-ddl-parserInstalling simple-ddl-parser
Before you install
Low friction installation with a single runtime dependency (ply). Actively maintained with recent commits and a stable release cadence; maintainer explicitly guarantees backward compatibility in patch and minor versions.
License in practice
MIT license permits unrestricted use, modification, and distribution in commercial and private projects with minimal obligations.
Quickstart
from simple_ddl_parser import DDLParser
ddl = "CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(2000))"
result = DDLParser(ddl).run()
print(result)
Requires Python 3.9 or later; ply must be installed as a runtime dependency.
Verify before relying
- Extent of support for edge cases and less common SQL dialects beyond the documented list.
- Performance characteristics when parsing very large or complex DDL files.
- Accuracy of output structure consistency across all supported dialects and output modes.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — ply |
| Maintenance | actively maintained — 139 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 264,743/month — #8,333 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: simple_ddl_parser-1.13.0-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
ddlparseParses CREATE TABLE DDL statements from MySQL,…
permissive · top 15,000 on PyPI
mo-sql-parsingParses SQL queries into JSON-serializable parse…
copyleft · top 15,000 on PyPI
pydbmlPyDBML parses and generates DBML (Database…
permissive · top 15,000 on PyPI
sqlglotSQLGlot parses, transpiles, optimizes, and…
permissive · top 1,000 on PyPI
sqlglotrsA SQL parser, transpiler, and optimizer that…
permissive · top 5,000 on PyPI
acryl-sqlglotParses, transpiles, and optimizes SQL across 23…
permissive · top 15,000 on PyPI
collate-sqlfluffSQLFluff is a SQL linter and auto-fixer that…
permissive · top 15,000 on PyPI
sqlglotcProvides mypyc-compiled C extensions that…
permissive · top 5,000 on PyPI
sqllineageSQLLineage parses SQL statements to extract and…
permissive · top 5,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI