Update use of sqlhelpers.insert_filler.

This commit is contained in:
voussoir 2022-08-13 13:04:25 -07:00
parent 4128b04458
commit 1dbb384c85
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -91,9 +91,9 @@ def insert_id(id, commit=True):
if not existing: if not existing:
data = {'id': id} data = {'id': id}
columns = SQL_COLUMNS['sticks'] columns = SQL_COLUMNS['sticks']
(qmarks, bindings) = sqlhelpers.insert_filler(columns, data, require_all=False) (qmarks, bindings) = sqlhelpers.insert_filler(data)
query = f'INSERT INTO sticks VALUES({qmarks})' query = f'INSERT INTO sticks {qmarks}'
cur.execute(query, bindings) cur.execute(query, bindings)
if commit: if commit:
@ -118,8 +118,8 @@ def insert_stick(data, commit=True):
(qmarks, bindings) = sqlhelpers.update_filler(data, 'id') (qmarks, bindings) = sqlhelpers.update_filler(data, 'id')
query = f'UPDATE sticks {qmarks}' query = f'UPDATE sticks {qmarks}'
else: else:
(qmarks, bindings) = sqlhelpers.insert_filler(SQL_COLUMNS['sticks'], data) (qmarks, bindings) = sqlhelpers.insert_filler(data)
query = f'INSERT INTO sticks VALUES({qmarks})' query = f'INSERT INTO sticks {qmarks}'
cur.execute(query, bindings) cur.execute(query, bindings)