From 9d46f943894e15b4a70c64ecba6a3b684863a81f Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 2 Jun 2021 08:23:59 +0300 Subject: gn3: db: Add spacing before around "AND" in sql clause --- gn3/db/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'gn3/db') diff --git a/gn3/db/__init__.py b/gn3/db/__init__.py index 19135fc..d89dbf4 100644 --- a/gn3/db/__init__.py +++ b/gn3/db/__init__.py @@ -44,10 +44,10 @@ def update(conn: Any, k, v in asdict(data).items() if v is not None and k in TABLEMAP[table]) sql += " WHERE " - sql += "AND ".join(f"{TABLEMAP[table].get(k)} = " - f"'{escape_string(str(v)).decode('utf-8')}'" for - k, v in asdict(where).items() - if v is not None and k in TABLEMAP[table]) + sql += " AND ".join(f"{TABLEMAP[table].get(k)} = " + f"'{escape_string(str(v)).decode('utf-8')}'" for + k, v in asdict(where).items() + if v is not None and k in TABLEMAP[table]) with conn.cursor() as cursor: cursor.execute(sql) return cursor.rowcount @@ -61,10 +61,10 @@ def fetchone(conn: Any, return None sql = f"SELECT * FROM {table} " sql += "WHERE " - sql += "AND ".join(f"{TABLEMAP[table].get(k)} = " - f"'{escape_string(str(v)).decode('utf-8')}'" for - k, v in asdict(where).items() - if v is not None and k in TABLEMAP[table]) + sql += " AND ".join(f"{TABLEMAP[table].get(k)} = " + f"'{escape_string(str(v)).decode('utf-8')}'" for + k, v in asdict(where).items() + if v is not None and k in TABLEMAP[table]) with conn.cursor() as cursor: cursor.execute(sql) return DATACLASSMAP[table](*cursor.fetchone()) -- cgit v1.2.3