sql2mermaid-cli
sql2mermaid-cli is a CLI tool that converts SQL query into mermaid.js style!.
Required
Python >=3.8.1
Installation
To install sql2mermaid-cli, use the following command:
$ pip install sql2mermaid-cli
Getting Started
As a preparation, create a sample SQL file.
$ echo "with bar as (select * from baz)\n\
select * from foo inner join bar on foo.id = bar.id\n"> input.sql
The basic usage of sql2mermaid-cli is as follows:
$ sql2mermaid-cli -i input.sql
This will output the mermaid diagram to the console:
graph LR
bar([bar])
root([root])
baz[(baz)]
foo[(foo)]
bar --> baz
root --> foo
root --> bar
The Mermaid diagram that is outputted can be visualized on the Mermaid Live Editor website.
Options
To save the output to a file, use the -o option followed by the path to the output file:
$ sql2mermaid-cli -i input.sql -o output.txt
By default, the output format is plain text. To output the mermaid diagram in markdown format, use the -m option:
$ sql2mermaid-cli -i input.sql -o output.md -m
You can also specify either "upper" or "lower" after the -d option to display the join type of SQL in the mermaid diagram.
$ sql2mermaid-cli -i input.sql -d upper
This will output the mermaid diagram to the console:
graph LR
bar([bar])
foo([foo])
root[(root)]
baz[(baz)]
foo.id[(foo.id)]
bar.id[(bar.id)]
bar -- FROM --> baz
bar -- FROM --> foo
foo -- INNER JOIN --> bar
Author
License
This project is licensed under the MIT License - see the LICENSE.md for details
Metadata
Release files for sql2mermaid-cli 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sql2mermaid_cli-1.0.1.tar.gz | 5.3 kB | Without provenance | Details for sql2mermaid_cli-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sql2mermaid_cli-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for sql2mermaid_cli-1.0.1-py3-none-any.whl |
Total release size: 12.3 kB
Release files / sql2mermaid_cli-1.0.1.tar.gz
| Download URL | sql2mermaid_cli-1.0.1.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e6b876c6cb3d4ddb9735fc01e82f0e630c8a6ca9da97e4e823f9f3ba3af45b7
|
|
BLAKE2b-256 checksum How to use checksums |
05bbab7338bf1fb5660e80afe1753c6420807dddbb1c468f7d163430bb155222
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.10.4 Linux/5.15.90.1-microsoft-standard-WSL2
|
Release files / sql2mermaid_cli-1.0.1-py3-none-any.whl
| Download URL | sql2mermaid_cli-1.0.1-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6dd1dcba3859cc8137df48d4a7455564d672e636a60ad871f90c4b06dc3c1c74
|
|
BLAKE2b-256 checksum How to use checksums |
964e0f19ce2b987fa106f04acb75a85e3c0daa6a20933b0cf565997bc498da68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.10.4 Linux/5.15.90.1-microsoft-standard-WSL2
|
Security for sql2mermaid-cli 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.