[HN Gopher] Show HN: Easily Visualize Your SQLAlchemy Data Model...
___________________________________________________________________
Show HN: Easily Visualize Your SQLAlchemy Data Models in a Nice SVG
Diagram
Author : eigenvalue
Score : 20 points
Date : 2023-11-13 13:13 UTC (9 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| eigenvalue wrote:
| I made this last week for fun, but I think it could be useful for
| people. If your application has pretty complicated SQLalchemy
| data models (and the app I'm working on now has gotten super
| complicated, with dozens of models with complex
| interconnections), then this very easily generates an attractive
| SVG that you can open in the browser showing all your tables and
| how they are connected. You can be up and running with this in
| less than a minute-- just open it in Google Colab, replace the
| sample data models with your own, and run the notebook, and you
| should see the SVG displayed almost immediately at the bottom.
|
| I attempted to also generate an HTML file containing the embedded
| SVG as well as some JS to enable nice interactive hover-on
| effects (I wanted to highlight the border of the table you hover
| over and then change all the outgoing connections to other tables
| to be red, and all incoming connections to that table to be
| green), but it wasn't working and started turning into a slog
| after an hour. If anyone knows how to do this, please submit a
| PR!
| talboren wrote:
| gonna give it a try today, been wondering how come i never came
| across anything like that actually (been using the different
| clients tools)
| eigenvalue wrote:
| Yeah, it was a bit weird to me that I couldn't find anything
| like this either, which is why I made it. Seems like all the
| visualization tools out there go from the database tables
| directly, but that defeats the cross-database portability of
| SQLAlchemy which is one of its best features: it works equally
| well without any changes on SQLite, Postgres, etc.
| adr1an wrote:
| Nice. I've been using Django-schema-viewer and it's been great.
| This makes me wonder if its UI could be decoupled from Django...
| eigenvalue wrote:
| Cool. Yeah it would seem to limit the audience a lot that it's
| for Django only and also has to be integrated into an existing
| Django project for it to work. I wanted a very small and simple
| tool that worked generically for any SQLAlchemy models. The
| core code of my tool is literally ~90 lines of Python-- the
| other ~200 lines are all the sample data models I include.
| That's because all the real heavy lifting is done by graphviz.
___________________________________________________________________
(page generated 2023-11-13 23:02 UTC)