From cd0f1155d2b325aa0863268d4e27397ae34afdec Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 2 Jun 2021 07:38:53 +0300 Subject: gn3: db: Return None if data and where are empty --- gn3/db/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3/db') diff --git a/gn3/db/__init__.py b/gn3/db/__init__.py index fae4d29..1eb7b12 100644 --- a/gn3/db/__init__.py +++ b/gn3/db/__init__.py @@ -36,7 +36,7 @@ def update(conn: Any, data: Dataclass, where: Dataclass) -> Optional[int]: """Run an UPDATE on a table""" - if not any(astuple(data) + astuple(where)): + if not (any(astuple(data)) and any(astuple(where))): return None sql = f"UPDATE {table} SET " sql += ", ".join(f"{TABLEMAP[table].get(k)} " -- cgit v1.2.3