Hacker News new | past | comments | ask | show | jobs | submit login

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!




Nice, I hacked together something similar many moons ago, it looks like some fine folks have kept on maintaining and improving it: https://github.com/fschulze/sqlalchemy_schemadisplay

Useful to have in a CICD pipeline so you always have an up-to-date schema diagram available.


Cool, I'm surprised I couldn't find this when I was looking for something like this originally. Probably because I was using different terminology-- "data model" instead of "schema," and "visualize" instead of "display".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: