|
1 |
| -# sqlalchemy_data_model_visualizer |
2 |
| -Automatically turn your SQLalchemy Data Models into a Nice SVG Diagram |
| 1 | +# SQLAlchemy Data Model Visualizer |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This Python-based utility generates high-quality, readable visualizations of your SQLAlchemy ORM models. 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. |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- Automatically maps SQLAlchemy ORM models to a directed graph. |
| 10 | +- Table-like representation of each model with fields, types, and constraints. |
| 11 | +- Visual cues for primary keys, unique fields, and indexed fields. |
| 12 | +- Export diagrams to SVG format for high-quality viewing and printing. |
| 13 | + |
| 14 | +## Installation |
| 15 | + |
| 16 | +To get started, clone the repository and install the required packages. |
| 17 | + |
| 18 | +```bash |
| 19 | +git clone https://github.com/Dicklesworthstone/sqlalchemy_data_model_visualizer.git |
| 20 | +cd sqlalchemy_data_model_visualizer |
| 21 | +pip install -r requirements.txt |
| 22 | +``` |
| 23 | + |
| 24 | +## Requirements |
| 25 | + |
| 26 | +- Python 3.x |
| 27 | +- SQLAlchemy |
| 28 | +- Graphviz |
| 29 | +- lxml |
| 30 | + |
| 31 | +## Usage |
| 32 | + |
| 33 | +### Generate Data Model Diagram |
| 34 | + |
| 35 | +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. |
| 36 | + |
| 37 | +Then, simply call the `generate_data_model_diagram` function. This will generate an SVG file with the name `my_data_model_diagram.svg`. |
| 38 | + |
| 39 | +## API Documentation |
| 40 | + |
| 41 | +### `generate_data_model_diagram(models, output_file='my_data_model_diagram')` |
| 42 | + |
| 43 | +- `models`: List of SQLAlchemy models you want to visualize. |
| 44 | +- `output_file`: Name of the output SVG file. |
| 45 | + |
| 46 | +## Contributing |
| 47 | + |
| 48 | +Contributions are welcome! Please open an issue or submit a pull request. |
| 49 | + |
| 50 | +## License |
| 51 | + |
| 52 | +This project is licensed under the MIT License. |
0 commit comments