Python parser and builder for DBML
Low maintenance activity. Last release 13 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and recent releases.
pip install pydbmlDBML parser for Python
Compliant with DBML v3.9.5 syntax
PyDBML is a Python parser and builder for DBML syntax.
The project was rewritten in May 2022, the new version 1.0.0 is not compatible with versions 0.x.x. See details in Upgrading to PyDBML 1.0.0.
Docs:
PyDBML requires Python v3.8 or higher
Installation
You can install PyDBML using pip:
pip3 install pydbml
Quick start
To parse a DBML file, import the PyDBML class and initialize it with Path object
>>> from pydbml import PyDBML
>>> from pathlib import Path
>>> parsed = PyDBML(Path('test_schema.dbml'))
or with file stream
>>> with open('test_schema.dbml') as f:
... parsed = PyDBML(f)
or with entire source string
>>> with open('test_schema.dbml') as f:
... source = f.read()
>>> parsed = PyDBML(source)
>>> parsed
<Database>
The parser returns a Database object that is a container for the parsed DBML entities.