Skip to main content

Convert SQL table dependencies to mermaid.js

Project description


tox badge

sql2mermaid

Convert SQL table dependencies to the text of mermaid.js style!

Installation

WIP

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.0.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

sql2mermaid-1.0.0-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page