3 ms·
Agree with you, and it totally depends on how the project is going to unfold. Alembic works by introspecting the db (using sqla) and then creating a script, in
by aidos 9y ago
Agree with you, and it totally depends on how the project is going to unfold.
Alembic works by introspecting the db (using sqla) and then creating a script, in sqla, that migrates the current db to match the model defined in code. You can hook in to change that process. In our case, we wanted to create a fully automated Choice type using native python enums. We then added a hook to alembic so it could detect the inconsistency in between the constraints in the db and the code and update them accordingly. The whole thing is about 50 lines. There was a bit to learn, but with sqla / alembic you just slowly start peeling back the layers. Ironically that's all probably something that django has covered!