From d4f4af9398e3fc60667fc8e13f19b2fde2f5ad86 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 21 May 2020 10:33:13 +1000 Subject: [PATCH] Use the proper construction for 'where' clauses --- src/pyelephant.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pyelephant.py b/src/pyelephant.py index e9732ad..4369b81 100755 --- a/src/pyelephant.py +++ b/src/pyelephant.py @@ -18,7 +18,7 @@ def add(session: sa.orm.Session, title: str): # ----------------------------------------------------------------------------- def rm(session: sa.orm.Session, index: int): - session.query(Task.id == index).delete() + session.query(Task).filter(Task.id == index).delete() session.commit() @@ -29,8 +29,8 @@ def show_by_obj(session: sa.orm.Session, obj: Task): # ----------------------------------------------------------------------------- def show_by_id(session: sa.orm.Session, index: int): - obj = session.query(Task.id == index) - show_by_obj(obj) + obj = session.query(Task).filter(Task.id == index).one() + show_by_obj(session, obj) # -----------------------------------------------------------------------------