Wednesday, August 13, 2008

Miruku - Migrations for SQLALchemy

One of the painful things about working with any database-oriented project in production is that you can't just drop the database and re-create every time you have a schema change. (Of course, you could do that, but your users might get a little miffed when their data disappears.) Rails and Django have for this reason had support for migrating from one schema version to another. Well, now SQLAlchemy has a automatic migrations tool by the name of Miruku. I haven't tried it, and it's an extremely early version (0.1a7), but it looks promising. Have a look here, and let me know what you think.

8 comments:

  1. I do not think Django has any short of schema change support. The developer must issue all their own SQL commands to keep the tables in sync with the Django models.

    Although they have been adding lots of nice stuff for the 1.0 push. Perhaps I am using outdated experience.

    ReplyDelete
  2. You may also want to take a look at:

    http://code.google.com/p/sqlalchemy-migrate/

    which has been around for a while, and has the same goals.

    TG2 has been including this migration library for a little while, but we haven't documented how to use it :(

    ReplyDelete
  3. pete and mark,

    Thanks for the comments. As to Django, I guess I must have confused Rails migrations with Django. As for sqlalchemy-migrate, thanks for the pointer. I remember hearing about it before, but I wasn't too familiar with it. It looks like sqlalchemy-migrate even supports automatic script generation. I wonder if the two projects could benefit from one another...?

    ReplyDelete
  4. Django has several tools for migrating schemas. One of my favourites:

    http://code.google.com/p/deseb/

    ReplyDelete
  5. @manuel - Thanks for the tip!

    ReplyDelete
  6. I found this to be a great quickstart on sqlalchemy-migrate : http://spyced.blogspot.com/2008/07/sqlalchemy-migrate-for-dummies.html

    ReplyDelete
  7. hmm, that link might work better as sqlalchemy migrate for dummies

    ReplyDelete
  8. AFAIK, Django will have migrations in 1.0, it's recently been checked in.

    ReplyDelete