Convert SQL table dependencies to mermaid.js
Project description
sql2mermaid
Convert SQL table dependencies to the text of mermaid.js style!
Required
Python >=3.9
Installation
pip install sql2mermaid
Getting Started
import sql2mermaid
sql = """
with bar as (select * from baz)
select * from foo inner join bar on foo.id = bar.id
"""
txt = sql2mermaid.convert(sql)
print(txt)
Result
graph LR
bar([bar])
root([root])
baz[(baz)]
foo[(foo)]
bar --> baz
root --> foo
root --> bar
You can get a diagram of the table dependencies by pasting this into Mermaid Live Editor, Diagrams.net (Draw.io), etc.
Options
You can change the name of the root and whether the FROM, JOIN clause is displayed.
How to Develop
If you've installed Poetry on your machine, you can test it by doing the following:
poetry run tox
Author
License
This project is licensed under the MIT License - see the LICENSE.md for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sql2mermaid-2.2.1.tar.gz.
File metadata
- Download URL: sql2mermaid-2.2.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.6 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5e8163d37a39c2a46572bbfed2c96434bb19502e422612f61b44271a26821ac
|
|
| MD5 |
806d793fa0a9ee35debd2d85fae0a80a
|
|
| BLAKE2b-256 |
4c4298c2018ac38614a9fc26207b11d47af2200d6b68e51a45a9cef366c5e6b1
|
File details
Details for the file sql2mermaid-2.2.1-py3-none-any.whl.
File metadata
- Download URL: sql2mermaid-2.2.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.6 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89bdc5c9979ac9fef91a9d65f0f244aa0af665dc09ce4a980509799544085909
|
|
| MD5 |
2b107791b5783cc0f61d9a0b5abbdc42
|
|
| BLAKE2b-256 |
9f89b9e1a1b62331c300404e430fdb9806c4e0c871cf22a4612c947ae3d6ac25
|