Search code examples
pythonsqlalchemydatabase-migration

how update database fields in orm+python when tables column is changed?


I use Sqlalchemy orm,python, python migrate for my project that is a project about Accounting. my issue is: for example in version 1 the fields of a tables has a 4 colomun. I release project and a person use this for her work. he input data to table. I work in project and release version 2 of project so that the has 5 fields. how to update the project to last version so that data in older table import to new table. merci.


Solution

  • Use alembic. It provides you with the ability to do table migrations on software updates. Read the documentation on how to integrate it in your project.