skillfed

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.

simple-ddl-parser v1.13.0 264.7K downloads/30d#8,333 on PyPI222
Permissive license MIT Active released

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-parser

uv

uv add simple-ddl-parser

poetry

poetry add simple-ddl-parser

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: PL/SQLProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: SQLTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities

Tags

SQL DDL parserparse SQL schemaextract table structure from DDLSQL dialect parserconvert DDL to JSONdatabase schema parsingHQL parser
sql-parsingschema-extractionddl

More Software Development packages