From bac4595e08c23859345e8c80af8db5dd36c269b9 Mon Sep 17 00:00:00 2001 From: Brian Rosmaita Date: Tue, 13 Feb 2018 16:42:51 -0500 Subject: [PATCH] Use bool instead of int for boolean filter value At this layer, it's a boolean filter; we should let the ORM make the translation for whatever backend is in use. MySQL didn't care, but PostgreSQL is a bit more picky. Co-authored-by: Scott McClymont Co-authored-by: Brian Rosmaita Change-Id: Id1e5d2cec3be48f6a5164582591f2fd2f565a96b Closes-bug: #1749297 --- glance/db/sqlalchemy/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glance/db/sqlalchemy/api.py b/glance/db/sqlalchemy/api.py index 6c2621454f..57f46c00f8 100644 --- a/glance/db/sqlalchemy/api.py +++ b/glance/db/sqlalchemy/api.py @@ -1469,9 +1469,9 @@ def _task_soft_delete(context, session=None): query = session.query(models.Task) query = (query.filter(models.Task.owner == context.owner) - .filter_by(deleted=0) + .filter_by(deleted=False) .filter(expires_at <= timeutils.utcnow())) - values = {'deleted': 1, 'deleted_at': timeutils.utcnow()} + values = {'deleted': True, 'deleted_at': timeutils.utcnow()} with session.begin(): query.update(values)