A module to display sqlalchemy database tables and keys as a graph
Project description
Sqlalchemy DB graphing tool
A module to display sqlalchemy database tables and keys as a graph.
license: MIT license
Features
Generate graphs from your sqlalchemy declarative database in one simple function call.
How to use:
from sqlalchemy_db_graphing import generate_graph_as_png
from mymodule.database_schema import MySQLAlchemySchema
filename = "path/to/save/file.png"
generate_graph_as_png(metadata=MySQLAlchemySchema.metadata, filename=filename)
generate_graph_as_png also supports basic arguments:
pk_color: color of primary keys.fk_color: color of foreign keys.pk_and_fk_color: color of columns that are both a primary and a foreign key.display_legend: whether the legend is displayed or not.
Finally, it supports all graphviz arguments, see https://graphviz.org/docs/graph/ for a comprehensive list.
generate_graph_as_png(
metadata=MySQLAlchemySchema.metadata,
filename=filename,
display_legend=True,
rankdir="LR", # Draw the graph from Left to Right instead of Top Down.
splines = "ortho",
)
The module also includes a few other functions:
generate_graph_as_svgfor svg pictures generation.generate_graph_as_pydotto get a pydot representation of your declarative base.get_schema_metadata_from_live_databaseto retrieve the metadata from a live database instead of the declarative database
Example with live database:
from sqlalchemy_db_graphing import get_schema_metadata_from_live_database
database_url = f"postgresql+asyncpg://username:password@host:port/db_name"
metadata = get_schema_metadata_from_live_database(url=database_url, schema="my_app_schema")
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
- Cookiecutter: https://github.com/audreyr/cookiecutter
audreyr/cookiecutter-pypackage: https://github.com/audreyr/cookiecutter-pypackage
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqlalchemy_db_graphing-0.1.0.tar.gz.
File metadata
- Download URL: sqlalchemy_db_graphing-0.1.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cedf25eb9b1b3db3661f3d3e74f89417314b55aa72747edfea0b57a2bc9343dd
|
|
| MD5 |
09516de42f508d1e6817edc5f9f659d2
|
|
| BLAKE2b-256 |
9a1ef1f8e19739873481d36a56da0e68d3aded342ce47d0fdf01439ad1ea8fad
|
Provenance
The following attestation bundles were made for sqlalchemy_db_graphing-0.1.0.tar.gz:
Publisher:
publish.yaml on erwann-met/sqlalchemy-db-graphing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlalchemy_db_graphing-0.1.0.tar.gz -
Subject digest:
cedf25eb9b1b3db3661f3d3e74f89417314b55aa72747edfea0b57a2bc9343dd - Sigstore transparency entry: 151478378
- Sigstore integration time:
-
Permalink:
erwann-met/sqlalchemy-db-graphing@61ac8b52a1d02b06752572c0a8cb845e8f62758b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/erwann-met
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@61ac8b52a1d02b06752572c0a8cb845e8f62758b -
Trigger Event:
release
-
Statement type:
File details
Details for the file sqlalchemy_db_graphing-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sqlalchemy_db_graphing-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07eef4819fac5e82cd3b214aeba67717cd5bf386765ec96d02e539a036bc84ab
|
|
| MD5 |
f8b33e6fef74f8f1c892a5fc9ed79d40
|
|
| BLAKE2b-256 |
3c1e70c70abfd6ba58e88e8912c95b8b830f9e1a308a855040291b6c7f50bcb7
|
Provenance
The following attestation bundles were made for sqlalchemy_db_graphing-0.1.0-py3-none-any.whl:
Publisher:
publish.yaml on erwann-met/sqlalchemy-db-graphing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlalchemy_db_graphing-0.1.0-py3-none-any.whl -
Subject digest:
07eef4819fac5e82cd3b214aeba67717cd5bf386765ec96d02e539a036bc84ab - Sigstore transparency entry: 151478379
- Sigstore integration time:
-
Permalink:
erwann-met/sqlalchemy-db-graphing@61ac8b52a1d02b06752572c0a8cb845e8f62758b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/erwann-met
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@61ac8b52a1d02b06752572c0a8cb845e8f62758b -
Trigger Event:
release
-
Statement type: