Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
How to migrate after SQLalchemy schema changes?
When I set up my object mappings with SQLalchemy, everything works well enough. It even creates the tables for me if they don't exist.
However, if I decide to add/remove columns (aka fields) from an object, it starts erroring out with my old test data because it's got the old column set. Obviously I can drop my old test data and start over, but it's hard to generate new test data every time.
How can I make the old tables come back into sync again after changing SQLalchemy models? Or does SQLalchemy fundamentally require you to accept data loss in this situation?
2 comment threads