• Stars
    star
    244
  • Rank 165,885 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 1 year ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Automatically turn your SQLalchemy Data Models into a Nice SVG Diagram

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

Try it Out Easily in Colab:

Open In Colab

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:

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.

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.

More Repositories

1

llm_aided_ocr

Enhance Tesseract OCR output for scanned PDFs by applying Large Language Model (LLM) corrections.
Python
1,990
star
2

swiss_army_llama

A FastAPI service for semantic text search using precomputed embeddings and advanced similarity measures, with built-in support for various file types through textract.
Python
919
star
3

bulk_transcribe_youtube_videos_from_playlist

Easily take an entire YouTube playlist and turn it into high quality transcripts using Whisper.
Python
430
star
4

automatic_log_collector_and_analyzer

Replace Splunk in your small company with this one weird trick!
Python
394
star
5

fast_vector_similarity

The Fast Vector Similarity Library is designed to provide efficient computation of various similarity measures between vectors.
Rust
339
star
6

visual_astar_python

Generate Cool-Looking Mazes and Animations Illustrating the A* Pathfinding Algorithm
Python
167
star
7

introduction_to_temporal_logic

An introduction to temporal logic and how it can be used to analyze concurrency
103
star
8

hoeffdings_d_explainer

A Detailed Introduction to My Favorite Statistical Measure, Hoeffding's D
94
star
9

bakery_algorithm

Lamport's Bakery Algorithm Demonstrated in Python
Python
94
star
10

grassmann_article

50
star
11

llm_aided_transcription_improvement

Improve a Transcript from a YouTube Video, Podcast, or other source using LLMs
Python
41
star
12

cloud_benchmarker

Cloud Benchmarker automates performance testing of cloud instances, offering insightful charts and tracking over time.
Python
33
star
13

the_lighthill_debate_on_ai

A Full Transcript of the Lighthill Debate on AI from 1973, with Introductory Remarks
25
star
14

anti_alzheimers_flasher

HTML
20
star
15

youtube_transcript_cleaner

YouTube Transcript Cleaner is a simple web-based application that improves the readability of YouTube transcripts.
HTML
19
star
16

prepareprojectforllmprompt

Transform your code project into a Markdown document optimized for interaction with Language Learning Models like GPT-4, complete with dynamic file selection and token management features.
TypeScript
17
star
17

sassaman_and_dingledine_on_remailers_at_blackhat_2003

A Full Transcript and Slides from the talk "Attacks on Anonymity Systems: The Theory" by Len Sassaman and Roger Dingledine in 2003
13
star
18

paxos_vs_raft

11
star
19

most-influential-github-repo-stars

See the most influential users who have starred or forked a given repo (sorted by earned stars and follower count)
TypeScript
8
star
20

some_thoughts_on_ai_alignment

Some Thoughts on AI Alignment: Using AI to Control AI
4
star
21

textsynth_server_cluster

Python
3
star
22

causal_direction_estimation_from_data

Automated Python script for data-driven causal inference, leveraging machine learning models and statistical error analysis to uncover hidden causal relationships.
Python
2
star
23

llm_aided_legal_discovery_bot

Python
2
star
24

ChatTTS

Forked to make it installable via pip
Jupyter Notebook
2
star
25

ball_fighters

HTML
2
star
26

automatic_cpp_code_analysis_with_gpt

Python
1
star
27

github_stars_curve

JavaScript
1
star
28

advice_for_learning_to_code_and_making_an_app

HTML
1
star
29

github-diff-viewer

JavaScript
1
star