Skip to main content

Convert SQL table dependencies to mermaid.js

Project description


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

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-2.2.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sql2mermaid-2.2.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

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

Hashes for sql2mermaid-2.2.1.tar.gz
Algorithm Hash digest
SHA256 f5e8163d37a39c2a46572bbfed2c96434bb19502e422612f61b44271a26821ac
MD5 806d793fa0a9ee35debd2d85fae0a80a
BLAKE2b-256 4c4298c2018ac38614a9fc26207b11d47af2200d6b68e51a45a9cef366c5e6b1

See more details on using hashes here.

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

Hashes for sql2mermaid-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89bdc5c9979ac9fef91a9d65f0f244aa0af665dc09ce4a980509799544085909
MD5 2b107791b5783cc0f61d9a0b5abbdc42
BLAKE2b-256 9f89b9e1a1b62331c300404e430fdb9806c4e0c871cf22a4612c947ae3d6ac25

See more details on using hashes here.

Supported by

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