SQLAlchemy-Migrate vs Alembic

I made this list while evaluating schema migration tools for SQLAlchemy (currently at 0.7.3) with PostgreSQL and SQLite. This is a very high-level overview of my findings specifically related to the project I’m currently working on. I do not have experience with either SQLAlchemy-Migrate or Alembic, although I do have experience with Django South, so I’m familiar with the issues of schema branching, etc. At the time of this writing I have a working (patched) SQLAlchemy-Migrate 0.7.2 system, but did not yet try to get Alembic (0.1alphadev) up and running, mostly due to lack of documentation.

 

SQLAlchemy-Migrate pros:

  • nice documentation
  • seems to be more widely used in the community
  • has (experimental) schema/model comparison tools
  • maybe approximates non-linear (but ordered) versioning with timestamped scripts?
  • more development activity

SQLAlchemy-Migrate cons:

  • requires a patch to get make_update_script_for_model working with (SA 0.7.3?) TypeDecorator

 

Alembic pros:

  • may be simpler than SQLAlchemy-Migrate
  • written and recommended by Mike Bayer
  • non-linear versioning (looks nice, but do I really need it?)

Alembic cons:

  • no documentation (yet) documentation was published within a day of writing this… Mike Bayer is amazing.
  • no SQLite ALTER support, must build own dump/import system for SQLite
  • lacks schema/model comparison tools

 

Takeaway: Alembic looks promising, and maybe it will be the right choice sometime in the future. The lack of documentation and no support for SQLite ALTER makes it less appealing to me at this point.

The schema/model comparison features look like they could be very handy if they are reliable. They are currently experimental (and need a patch) in SQLAlchemy-Migrate, but non-existent in Alembic.

Leave a Reply