Convert SQL table dependencies to mermaid.js
Project description
sql2mermaid
Convert SQL table dependencies to the text of mermaid.js style!
Required
Python >=3.8.1
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.
Author
License
This project is licensed under the MIT License - see the LICENSE.md for details
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sql2mermaid-1.0.3.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for sql2mermaid-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d4557927867720d829b87fc5eeb843437c80a3bb436197b989ac1e8622fc169 |
|
MD5 | 67c56da51aabb653983ab27f762b6ec0 |
|
BLAKE2b-256 | 2946823f7b57397842363595756d44763400587145af6063a6c0da31bd6b3696 |