Skip to main content

PyPI - License GitHub Workflow Status (with event) PyPI PyPI - Python Version

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

Release files for sql2mermaid 2.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sql2mermaid 2.2.1
File Size Uploaded
sql2mermaid-2.2.1.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sql2mermaid 2.2.1
File Interpreter ABI Platform
sql2mermaid-2.2.1-py3-none-any.whl Python 3 none any Details

Total release size:12.2 kB

Release files / sql2mermaid-2.2.1.tar.gz

Download URL sql2mermaid-2.2.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f5e8163d37a39c2a46572bbfed2c96434bb19502e422612f61b44271a26821ac
BLAKE2b-256 checksum
How to use checksums
4c4298c2018ac38614a9fc26207b11d47af2200d6b68e51a45a9cef366c5e6b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.6 Darwin/24.5.0

Release files / sql2mermaid-2.2.1-py3-none-any.whl

Download URL sql2mermaid-2.2.1-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89bdc5c9979ac9fef91a9d65f0f244aa0af665dc09ce4a980509799544085909
BLAKE2b-256 checksum
How to use checksums
9f89b9e1a1b62331c300404e430fdb9806c4e0c871cf22a4612c947ae3d6ac25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.6 Darwin/24.5.0

Release history Release notifications | RSS feed

This release

2.2.1 This release

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page