aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
Diffstat (limited to 'gn3')
-rw-r--r--gn3/db/__init__.py16
1 files changed, 0 insertions, 16 deletions
diff --git a/gn3/db/__init__.py b/gn3/db/__init__.py
index 5676eb5..95b39d4 100644
--- a/gn3/db/__init__.py
+++ b/gn3/db/__init__.py
@@ -63,22 +63,6 @@ def update(conn: Any,
conn.commit()
return cursor.rowcount
-def insert(conn: Any,
- table: str,
- data: Dataclass) -> Optional[int]:
- """Run an INSERT into a table"""
- dict_ = {TABLEMAP[table].get(k): v for k, v in asdict(data).items()
- if v is not None and k in TABLEMAP[table]}
- sql = f"INSERT INTO {table} ("
- sql += ", ".join(f"{k}" for k in dict_.keys())
- sql += ") VALUES ("
- sql += ", ".join("%s" for _ in dict_.keys())
- sql += ")"
- with conn.cursor() as cursor:
- cursor.execute(sql, tuple(dict_.values()))
- conn.commit()
- return cursor.rowcount
-
def diff_from_dict(old: Dict, new: Dict) -> Dict:
"""Construct a new dict with a specific structure that contains the difference