--- /dev/null
+Description: Make ceilometer work with sqla 0.9.x
+ Ceilometer's migration 028 makes some very specific assumptions about sqla
+ data structures and exception paths, which are not true in sqla 0.9.x. In 0.8
+ you were shielded from errors on drop by sqla, but in 0.9 you get raw
+ exceptions from the db layer thrown all the way up, which causes a failure
+ condition when trying to delete the non existent alembic table.
+ .
+ We can get basically the same behavior as before by using the checkfirst=True
+ parameter on table definitions. This will actually ensure that we get the
+ table in question, and get the NoSuchTableError when we expect it.
+Author: Sean Dague <sean.dague@samsung.com>
+Date: Mon, 10 Mar 2014 22:06:32 +0000 (-0400)
+X-Git-Url: https://review.openstack.org/gitweb?p=openstack%2Fceilometer.git;a=commitdiff_plain;h=63f6d6af77d5fe7227b074ddc3e1594a424873e6
+Origin: upstream, https://review.openstack.org/#/c/79482/
+Change-Id: Ida33a3030fb03c2f3eeed9f129fcc0063a7b7c4b
+
+diff --git a/ceilometer/storage/sqlalchemy/migrate_repo/versions/028_alembic_migrations.py b/ceilometer/storage/sqlalchemy/migrate_repo/versions/028_alembic_migrations.py
+index b527692..567620c 100644
+--- a/ceilometer/storage/sqlalchemy/migrate_repo/versions/028_alembic_migrations.py
++++ b/ceilometer/storage/sqlalchemy/migrate_repo/versions/028_alembic_migrations.py
+@@ -21,7 +21,10 @@ import sqlalchemy as sa
+ def get_alembic_version(meta):
+ """Return Alembic version or None if no Alembic table exists."""
+ try:
+- a_ver = sa.Table('alembic_version', meta, autoload=True)
++ a_ver = sa.Table(
++ 'alembic_version',
++ meta,
++ autoload=True)
+ return sa.select([a_ver.c.version_num]).scalar()
+ except sa.exc.NoSuchTableError:
+ return None
+@@ -29,7 +32,10 @@ def get_alembic_version(meta):
+
+ def delete_alembic(meta):
+ try:
+- sa.Table('alembic_version', meta, autoload=True).drop()
++ sa.Table(
++ 'alembic_version',
++ meta,
++ autoload=True).drop(checkfirst=True)
+ except sa.exc.NoSuchTableError:
+ pass
+