about summary refs log tree commit diff
path: root/gn3/db
diff options
context:
space:
mode:
authorBonfaceKilz2021-06-02 08:23:59 +0300
committerBonfaceKilz2021-06-03 21:58:31 +0300
commit8d29add407d5662995dbc9e94901636b15d32475 (patch)
treefea07ff03ce88fe9dc65633f2dd7e390bd5f47cd /gn3/db
parent6f138e3c87ca5d2b8277d185258796da88ed839f (diff)
downloadgenenetwork3-8d29add407d5662995dbc9e94901636b15d32475.tar.gz
gn3: db: Add spacing before around "AND" in sql clause
Diffstat (limited to 'gn3/db')
-rw-r--r--gn3/db/__init__.py16
1 files changed, 8 insertions, 8 deletions
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())