Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate database schema diagrams from SQLAlchemy models #220

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

chouinar
Copy link
Contributor

@chouinar chouinar commented Dec 22, 2023

Ticket

Resolves #219

Changes

Generate database schema diagrams (ERDs) from our SQLAlchemy tables

Automate this in our CI/CD

Context for reviewers

I added this in the simpler grants.gov codebase that is derived from this: HHS/simpler-grants-gov#824 and this logic is originally from a few of our other projects that the template API is based on.

Testing

The image within this PR was generated by the script which just requires running make db-create-schema-diagrams

The workflow ran on this PR: https://github.com/navapbc/template-application-flask/actions/runs/7302558921/job/19901412292

@@ -40,6 +40,8 @@ pytest-watch = "^4.2.0"
pytest-lazy-fixture = "^0.6.3"
types-pyyaml = "^6.0.12.11"
setuptools = "^68.2.2"
sadisplay = "0.4.9"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this tool is archived
image

eralchemy looks like it has a lot more stars/forks, and the diagrams look better.

Taking a step back, we'll probably need something like this regardless of the tech stack so that we don't have to maintain two separate implementations for python and next.js templates (and in the future we'll probably have a java template too), so I'd like to explore a language-agnostic one that runs in the infra template.

From browsing this reddit post, it seems that https://github.com/schemaspy/schemaspy is pretty nice. I like that the generated documentation is also interactive. For example, the diagram we have on MA PFML is pretty impossible to navigate and read since it's so big, so having interactive features could be really nice. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course it was archived 4 days after I added it to the Grants repo - If I've got time I'll look into Schema spy in the near future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate database schema diagrams from SQLAlchemy models
3 participants