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?
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 sqlalchemy. models. Instance object at 0x4195a90>
Out[4]: <nova.db.
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?