Keeping python code and database in sync

Roy Smith roy at panix.com
Fri Aug 29 10:54:33 EDT 2014


In article <mailman.13604.1409316126.18130.python-list at python.org>,
 "Frank Millman" <frank at chagford.com> wrote:

> The project is inherently database-driven. The python code expects to find 
> certain tables and columns in the database. As I develop new features, I 
> sometimes need to modify the database structure. In the bad old days (like 
> yesterday) I would just make the modifications and carry on. Now I have to 
> be aware that others may have downloaded the project, so I have to consider 
> how to ensure that their database is kept up to date.

Yeah, schema migration is an ugly problem.  There's a number of tools to 
help here, most of which reduce the suckitude, but don't eliminate it 
completely.  Some things you might want to look at:

* SQLAlchemy Migrate
* South (django-specific)
* yoyo-migrations
* alembic

Google for "python schema migration tools" and you'll probably find 
others.



More information about the Python-list mailing list