# SQLAlchemy Data Model Visualizer
## Overview
This Python-based utility generates high-quality, readable visualizations of your SQLAlchemy ORM models with almost no effort. With a focus on clarity and detail, it uses Graphviz to render each model as a directed graph, making it easier to understand the relationships between tables in your database schema.
![Example Data Model Diagram](https://raw.githubusercontent.com/Dicklesworthstone/sqlalchemy_data_model_visualizer/main/my_interactive_data_model_diagram.svg)
## Try it Out Easily in Colab:
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1np5kPvDtdhq138eLHOGINYuTUMJo_wrj?usp=sharing)
## Features
- Automatically maps SQLAlchemy ORM models to a directed graph.
- Table-like representation of each model with fields, types, and constraints.
- Export diagrams to SVG format for high-quality viewing and printing using Roboto font.
## Installation with pip and Usage:
```bash
pip install sqlalchemy-data-model-visualizer
# Suppose these are your SQLAlchemy data models defined above in the usual way, or imported from another file:
models = [GenericUser, Customer, ContentCreator, UserSession, FileStorage, ServiceRequest, GenericAuditLog, GenericFeedback, GenericAPIKey, GenericNotification, GenericAPICreditLog, GenericSubscriptionType, GenericSubscription, GenericSubscriptionUsage, GenericBillingInfo]
output_file_name = 'my_data_model_diagram'
generate_data_model_diagram(models, output_file_name)
add_web_font_and_interactivity('my_data_model_diagram.svg', 'my_interactive_data_model_diagram.svg')
```
## Installation from Source
To get started, clone the repository and install the required packages.
```bash
git clone https://github.com/Dicklesworthstone/sqlalchemy_data_model_visualizer.git
cd sqlalchemy_data_model_visualizer
python3 -m venv venv
source venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install wheel
pip install -r requirements.txt
```
## Requirements
- Python 3.x
- SQLAlchemy
- Graphviz
- lxml
## Usage
### Generate Data Model Diagram
First, paste in your SQLAlchemy models. A set of fairly complex data models are provided in the code directly as an example-- just replace these with your own from your application.
Then, simply call the `generate_data_model_diagram` function. This will generate an SVG file with the name `my_data_model_diagram.svg`.
## API Documentation
### `generate_data_model_diagram(models, output_file='my_data_model_diagram', add_labels=True)`
- `models`: List of SQLAlchemy models you want to visualize.
- `output_file`: Name of the output SVG file.
- `add_labels`: Set to False to hide labels on the edges between tables
## Contributing
Contributions are welcome! Please open an issue or submit a pull request.
## License
This project is licensed under the MIT License.
Raw data
{
"_id": null,
"home_page": "https://github.com/Dicklesworthstone/sqlalchemy_data_model_visualizer",
"name": "sqlalchemy-data-model-visualizer",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "sqlalchemy visualization graphviz data-model",
"author": "Jeffrey Emanuel",
"author_email": "jeff@pastel.network",
"download_url": "https://files.pythonhosted.org/packages/f5/71/c7a37401fe8fa24c7b46627c39e18d806f42e7fb41613d4091e4c36a4c00/sqlalchemy_data_model_visualizer-0.1.3.tar.gz",
"platform": null,
"description": "# SQLAlchemy Data Model Visualizer\n\n## Overview\n\nThis Python-based utility generates high-quality, readable visualizations of your SQLAlchemy ORM models with almost no effort. With a focus on clarity and detail, it uses Graphviz to render each model as a directed graph, making it easier to understand the relationships between tables in your database schema.\n\n![Example Data Model Diagram](https://raw.githubusercontent.com/Dicklesworthstone/sqlalchemy_data_model_visualizer/main/my_interactive_data_model_diagram.svg)\n\n## Try it Out Easily in Colab:\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1np5kPvDtdhq138eLHOGINYuTUMJo_wrj?usp=sharing)\n\n## Features\n\n- Automatically maps SQLAlchemy ORM models to a directed graph.\n- Table-like representation of each model with fields, types, and constraints.\n- Export diagrams to SVG format for high-quality viewing and printing using Roboto font. \n\n## Installation with pip and Usage:\n\n```bash\npip install sqlalchemy-data-model-visualizer\n\n# Suppose these are your SQLAlchemy data models defined above in the usual way, or imported from another file:\nmodels = [GenericUser, Customer, ContentCreator, UserSession, FileStorage, ServiceRequest, GenericAuditLog, GenericFeedback, GenericAPIKey, GenericNotification, GenericAPICreditLog, GenericSubscriptionType, GenericSubscription, GenericSubscriptionUsage, GenericBillingInfo]\noutput_file_name = 'my_data_model_diagram'\ngenerate_data_model_diagram(models, output_file_name)\nadd_web_font_and_interactivity('my_data_model_diagram.svg', 'my_interactive_data_model_diagram.svg')\n```\n\n## Installation from Source\n\nTo get started, clone the repository and install the required packages.\n\n```bash\ngit clone https://github.com/Dicklesworthstone/sqlalchemy_data_model_visualizer.git\ncd sqlalchemy_data_model_visualizer\npython3 -m venv venv\nsource venv/bin/activate\npython3 -m pip install --upgrade pip\npython3 -m pip install wheel\npip install -r requirements.txt\n```\n\n## Requirements\n\n- Python 3.x\n- SQLAlchemy\n- Graphviz\n- lxml\n\n## Usage\n\n### Generate Data Model Diagram\n\nFirst, paste in your SQLAlchemy models. A set of fairly complex data models are provided in the code directly as an example-- just replace these with your own from your application.\n\nThen, simply call the `generate_data_model_diagram` function. This will generate an SVG file with the name `my_data_model_diagram.svg`.\n\n## API Documentation\n\n### `generate_data_model_diagram(models, output_file='my_data_model_diagram', add_labels=True)`\n\n- `models`: List of SQLAlchemy models you want to visualize.\n- `output_file`: Name of the output SVG file.\n- `add_labels`: Set to False to hide labels on the edges between tables\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n\n## License\n\nThis project is licensed under the MIT License.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A tool to visualize SQLAlchemy data models with Graphviz.",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/Dicklesworthstone/sqlalchemy_data_model_visualizer"
},
"split_keywords": [
"sqlalchemy",
"visualization",
"graphviz",
"data-model"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ef533aeb421486e8658ef793b4dc33aa24c58e47b9748d7714b3b4a9ff02eb4a",
"md5": "95aefc11d4d09e17b809f9f9b353af90",
"sha256": "aac23e64f0c9c4e4683908b7e350aabf30353743ed513ea29a2c07664373702c"
},
"downloads": -1,
"filename": "sqlalchemy_data_model_visualizer-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "95aefc11d4d09e17b809f9f9b353af90",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7056,
"upload_time": "2023-11-06T04:18:22",
"upload_time_iso_8601": "2023-11-06T04:18:22.181500Z",
"url": "https://files.pythonhosted.org/packages/ef/53/3aeb421486e8658ef793b4dc33aa24c58e47b9748d7714b3b4a9ff02eb4a/sqlalchemy_data_model_visualizer-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f571c7a37401fe8fa24c7b46627c39e18d806f42e7fb41613d4091e4c36a4c00",
"md5": "6f9e12b509764c39d3e5f343e30aaf72",
"sha256": "ae829e040627be392bb23dd81030df8197096d5e6ddc815d0bbceed8a74b8a2c"
},
"downloads": -1,
"filename": "sqlalchemy_data_model_visualizer-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "6f9e12b509764c39d3e5f343e30aaf72",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6668,
"upload_time": "2023-11-06T04:18:23",
"upload_time_iso_8601": "2023-11-06T04:18:23.496974Z",
"url": "https://files.pythonhosted.org/packages/f5/71/c7a37401fe8fa24c7b46627c39e18d806f42e7fb41613d4091e4c36a4c00/sqlalchemy_data_model_visualizer-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-06 04:18:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Dicklesworthstone",
"github_project": "sqlalchemy_data_model_visualizer",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "sqlalchemy-data-model-visualizer"
}