Skip to content

Latest commit

 

History

32 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


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

About

No description, website, or topics provided.

Resources

Stars

29 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages