Brussels / 1 & 2 February 2014

schedule

Some recipes with Alembic


The SysGrove® project is mainly based on PyQt4 and SQLAlchemy. Application development and enhancement is ongoing and as a matter of fact, the database scheme is changing quite often with many migrations per day.

As the minimal set of data to test and run the application is quite important, we use Alembic to handle database migrations. It is rather simple to put Alembic in place and to run automatic migrations. The process is well documented in Alembic itself and has been detailed in some places on the web (http://www.chesnok.com/daily/2013/07/02/a-practical-guide-to-using-alembic/ for example). However it is more difficult to find examples of complex migration problems. Alembic auto-migration only handles the following cases : - Table additions, removals. - Column additions, removals. - Change of nullable status on columns. - Basic changes in indexes and explicitly-named unique constraints Combining Alembic together with SQLAlchemy provides many ways to handle more complex cases. In this talk, we will deal with examples such as : - rename a column in a table - adding an Enum column - add a none nullable columns in a table containing data - dealing with sequences - updating data from a migration scripts - ...

http://sysgrove.com/ http://pyqt.sourceforge.net/Docs/PyQt4/index.html http://www.sqlalchemy.org/

Speakers

Claude Huchet