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.
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
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.1.1.tar.gz
(4.1 kB
view details)
Built Distribution
File details
Details for the file sql2mermaid-1.1.1.tar.gz
.
File metadata
- Download URL: sql2mermaid-1.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.1 CPython/3.11.2 Darwin/21.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42d76fadeb44997bbcd94439c06dac3658c7a4f93eb97f4f841ec0b164931252 |
|
MD5 | 057aa99a48663bded324bb27110ffb29 |
|
BLAKE2b-256 | d13db1a68b85b62d47d5da328b83a53543945a3a166104cc785610e0ad00a715 |
File details
Details for the file sql2mermaid-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: sql2mermaid-1.1.1-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.1 CPython/3.11.2 Darwin/21.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b53b4797a8944cb60e0c51c12e43204a2051ddfcf9569870b6a62a2706266b4 |
|
MD5 | 59bd7cae35717a974434ea2a8cf6cf23 |
|
BLAKE2b-256 | 104172aa25e318a42711d9dbee79cf7681ba8dbc4d93a917d6457180a0e6b5a6 |