Do we have patches for approach #3?  I'm thinking that if we have a few specific issues, that maybe we could maintain our own branch and/or monkey-patch SA-migrate, and get a better handle on the problem, and the upstream's project receptiveness to patches (rather than bug reports).  <div>
<br></div><div>It's a bit more work now, but avoids a major change at this stage of the release.  One upside is that we'll hopefully have a better understanding when it comes time to write a replacement if we decide to go down that road.</div>
<div><br></div><div>My experience of SA-migrate was that it seemed powerful, but the documentation wasn't worth the paper it was written on :-)  It may be that we can fix a few bugs, figure out the "SA" way to do things, and end up happy.<br>
<div><br clear="all">Justin<br><br><br><br>
<br><br><div class="gmail_quote">On Mon, Mar 21, 2011 at 8:39 AM, Jay Pipes <span dir="ltr"><<a href="mailto:jaypipes@gmail.com">jaypipes@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hey all,<br>
<br>
For the better part of the last week, I've been struggling to use<br>
SQLAlchemy-Migrate to produce database migration scripts for Glance.<br>
In Glance, unlike Nova, we have a unit test that tests that the<br>
database for Glance's registry can be downgraded and upgraded<br>
smoothly. In Nova, none of the migrate scripts even contain a<br>
downgrade method, so this isn't even testable.<br>
<br>
We've found a number of problems in using SA-Migrate:<br>
<br>
1. When using the SQLite engine, if a table has a column with<br>
index=True on it and you drop any column on that table, SA-Migrate<br>
will die if you use Python migrate scripts<br>
(<a href="http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=117" target="_blank">http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=117</a>)<br>
2. When using the MySQL engine, you cannot use SQL scripts with<br>
multiple statements in them as upgrade/downgrade scripts<br>
(<a href="http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=99" target="_blank">http://code.google.com/p/sqlalchemy-migrate/issues/detail?id=99</a>)<br>
because SA-Migrate pipes all the statements into the<br>
Connection.execute() method as a single statement, causing the<br>
underlying MySQLdb driver to vomit an error 2014 "Commands out of<br>
sync"<br>
3. In order to solve #1 above, you need to do your own SQL scripting<br>
to bypass bugs in SA-Migrate. Writing the SQL script means you run<br>
into #2 above. This means you can't test both SQLite and MySQL<br>
migrations using the same scripts. This sucks. A lot.<br>
4. It seems the contributors to SA-Migrate are not responsive to bug<br>
reports. This makes it less than ideal as a dependency for Glance,<br>
especially considering the critical nature that database migrations<br>
play in installation and upgrading of our software.<br>
<br>
So, what to do? I see these options, none of which I particularly like:<br>
<br>
1) Don't test migration scripts - the Nova approach. This would mean<br>
we write all our migrate scripts as Python scripts, which work better<br>
with MySQL but break completely for SQLite. No idea about PostgreSQL.<br>
2) Don't use SA-Migrate and write a replacement using python-sqlparse<br>
and straight SQL scripts. While I can't stand SA-Migrate at this<br>
point, it remains really the only thing that remotely works.<br>
3) Submit patches to SA-Migrate and keep patched versions of<br>
SA-Migrate in the Glance PPA.<br>
<br>
Thoughts? I'm leaning towards #2, then #1, then #3.<br>
<br>
-jay<br>
<br>
_______________________________________________<br>
Mailing list: <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
Post to     : <a href="mailto:openstack@lists.launchpad.net">openstack@lists.launchpad.net</a><br>
Unsubscribe : <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
More help   : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/ListHelp</a><br>
</blockquote></div><br></div></div>