diff --git a/api/utility.py b/api/utility.py index da09b0e..bbd1187 100644 --- a/api/utility.py +++ b/api/utility.py @@ -4,12 +4,17 @@ from .operation import * from .change_set import ChangeSet -def query(name: str, sql: str) -> Row | None: +def read(name: str, sql: str) -> Row | None: with conn[name].cursor(row_factory=dict_row) as cur: cur.execute(sql) return cur.fetchone() +def write(name: str, sql: str) -> None: + with conn[name].cursor() as cur: + cur.execute(sql) + + def decorate(value: str | None, type: str, optional: bool) -> str: if optional: value = 'NULL' if value == None else value