Comment 4 for bug 701121

Revision history for this message
Ed Leafe (ed-leafe) wrote :

Correction: the default is actually False. I was confused because it was not returning the Instance even though the ID is present in the instances table. Looking in MySQL, I see:

mysql> select id, admin_pass, deleted from instances;
+----+------------+---------+
| id | admin_pass | deleted |
+----+------------+---------+
| 1 | NULL | 0 |
+----+------------+---------+
1 row in set (0.00 sec)

But if I set a break in the code, and execute the call directly, I get the following:

In [1]: result = session.query(models.Instance).filter_by(id=1).filter_by(deleted=False).first()

In [2]: result

In [3]: result = session.query(models.Instance).filter_by(id=1).filter_by(deleted=True).first()

In [4]: result
Out[4]: <nova.db.sqlalchemy.models.Instance object at 0x4195a90>

In [5]: result.id, result.deleted
Out[5]: (1, True)

So it seems that the original bug I reported is not valid. However, there is a different problem: why is sqlalchemy returning deleted=True for this record?