I'm fairly new to Python and ORMs and I have a pretty specific question. To handle SQL, a Python ORM needs to have models defined, likely in a file called models.py
, right?
Now, when I want to automatically create a new column when I add content to a table how do I avoid updating models.py
manually every time?
To give you some context: I have a db with the tables Persons
, Publications
and Articles
. I would like to create a table that takes an ID from Persons
as a new column and then fills its rows with all the IDs of Publications
that the Person is writing for (related via Articles
).
In this question Damian Brecht points to sqlalchemy-migrate but I don't get how you keep the definition of the models updated, since every column is a line of code in models.py
...