pydbml
Python parser and builder for DBML
What it is and what it does
PyDBML is a Python parser and builder for DBML, a human-readable markup language for defining database schemas. It reads DBML files or strings and constructs an in-memory representation of the schema as a Database object, allowing you to access tables, references, enums, and table groups programmatically. You can then generate SQL DDL statements from the parsed schema or regenerate DBML from modified objects.
The package is compliant with DBML v3.9.5 syntax and depends only on pyparsing for parsing. It's useful when you need to work with DBML schemas in Python code—reading them for documentation, validation, or transformation, or building schemas programmatically and exporting them as SQL or DBML.
Use it for:
- Parse a DBML schema file and generate SQL DDL to create database tables.
- Read DBML definitions and programmatically extract table and column metadata for documentation or tooling.
- Build a database schema in code and export it as DBML or SQL for version control and collaboration.
- Validate or transform DBML schemas by parsing, modifying, and regenerating them.
- Integrate DBML schema definitions into Python-based database migration or ORM tools.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyDBML parses and generates DBML (Database Markup Language) schemas, converting between DBML syntax and SQL or back to DBML format.
Yes. PyDBML is actively maintained, has no known vulnerabilities, installs with minimal friction, and is permissively licensed. Install it if you need to parse or generate DBML schemas in Python—it's the standard tool for that task.
Install
pydbml on PyPI
pip
pip install pydbmluv
uv add pydbmlpoetry
poetry add pydbmlInstalling pydbml
Before you install
Low install friction with a single runtime dependency (pyparsing). Active maintenance with a recent release in October 2025 and commits through April 2026.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects without licensing concerns.
Quickstart
from pydbml import PyDBML
from pathlib import Path
parsed = PyDBML(Path('schema.dbml'))
for table in parsed.tables:
print(table.name)
print(parsed.sql)
Requires Python 3.8 or higher.
Verify before relying
- Whether the parser handles all DBML v3.9.5 features or only a subset.
- Performance characteristics when parsing large or complex schemas.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pyparsing |
| Maintenance | actively maintained — 294 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 94,653/month — #13,319 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pydbml-1.2.1-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
ddlparseParses CREATE TABLE DDL statements from MySQL,…
permissive · top 15,000 on PyPI
simple-ddl-parserParses SQL DDL statements and their dialect…
permissive · top 15,000 on PyPI
jsonschema-pydantic-converterConverts JSON Schema definitions to Pydantic v2…
permissive · top 15,000 on PyPI
syntaqliteParse, format, validate, and tokenize SQLite…
permissive · top 15,000 on PyPI
PyMySQLPyMySQL is a pure-Python MySQL and MariaDB…
permissive · top 1,000 on PyPI
sqlalchemy-risingwaveProvides a SQLAlchemy dialect that enables…
permissive · top 15,000 on PyPI
jinjasqlGenerates parameterized SQL queries from Jinja2…
permissive · top 15,000 on PyPI
sql-metadataParses SQL queries using sqlglot and extracts…
permissive · top 5,000 on PyPI
python-chesspython-chess provides move generation, move…
copyleft · top 5,000 on PyPI
datamodel-code-generatorGenerates Python data models (Pydantic,…
permissive · top 5,000 on PyPI