At the moment there are a lot of raw SQL queries in the code. They should be replaced with code using SQLAlchemy.
---snip---
~/src/nova/trunk (bzr)-[trunk:709] % grep -r -i session.execute *
nova/db/sqlalchemy/api.py: result = session.execute('UPDATE fixed_ips SET instance_id = NULL, '
nova/db/sqlalchemy/api.py: session.execute('update instances set deleted=1,'
nova/db/sqlalchemy/api.py: session.execute('update security_group_instance_association '
nova/db/sqlalchemy/api.py: session.execute('update key_pairs set deleted=1 where user_id=:id',
nova/db/sqlalchemy/api.py: session.execute('update networks set project_id=NULL')
nova/db/sqlalchemy/api.py: session.execute('update volumes set deleted=1 where id=:id',
nova/db/sqlalchemy/api.py: session.execute('update export_devices set volume_id=NULL '
nova/db/sqlalchemy/api.py: session.execute('update iscsi_targets set volume_id=NULL '
nova/db/sqlalchemy/api.py: session.execute('update security_groups set deleted=1 where id=:id',
nova/db/sqlalchemy/api.py: session.execute('update security_group_instance_association '
nova/db/sqlalchemy/api.py: session.execute('update security_group_rules set deleted=1 '
nova/db/sqlalchemy/api.py: session.execute('update security_groups set deleted=1')
nova/db/sqlalchemy/api.py: session.execute('update security_group_rules set deleted=1')
nova/db/sqlalchemy/api.py: session.execute('delete from user_project_association '
nova/db/sqlalchemy/api.py: session.execute('delete from user_role_association '
nova/db/sqlalchemy/api.py: session.execute('delete from user_project_role_association '
nova/db/sqlalchemy/api.py: session.execute('delete from user_project_association '
nova/db/sqlalchemy/api.py: session.execute('delete from user_project_role_association '
nova/db/sqlalchemy/api.py: session.execute('delete from user_project_role_association where '
nova/db/sqlalchemy/api.py: session.execute('delete from consoles '
nova/db/sqlalchemy/api.py: session.execute('delete from zones '
---snap---
Hey! You stole my bug!
Seriously, you closer to having working code? I haven't worked with SQLAlchemy before and was researching it, intending this bug to be a good way of getting into the groove with it...but if you've got code now, then I guess I'll just have to swallow it and find something else to try...