aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2021-06-02 08:23:59 +0300
committerzsloan2021-06-18 22:08:04 +0000
commit9d46f943894e15b4a70c64ecba6a3b684863a81f (patch)
tree226831012b15213dda6f10f4e803d27bc6cec543
parenta2ef9618dbba2d3f0416cbe8a527ed12070aa67e (diff)
downloadgenenetwork3-9d46f943894e15b4a70c64ecba6a3b684863a81f.tar.gz
gn3: db: Add spacing before around "AND" in sql clause
-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())