From 29aeeb0614d7fdb20830640d3939e8d1d6b83c7a Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 13 Aug 2022 13:03:37 -0700 Subject: [PATCH] Update use of sqlhelpers.insert_filler. --- hnarchive.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hnarchive.py b/hnarchive.py index 23f6d32..5e7e64b 100644 --- a/hnarchive.py +++ b/hnarchive.py @@ -58,8 +58,6 @@ CREATE INDEX IF NOT EXISTS index_items_type_time on items(type, time); CREATE INDEX IF NOT EXISTS index_items_age_at_retrieval on items(retrieved - time); COMMIT; ''' -COLUMNS = sqlhelpers.extract_table_column_map(DB_INIT) -ITEMS_COLUMNS = COLUMNS['items'] def init_db(): global sql @@ -224,8 +222,8 @@ def insert_item(data): 'retrieved': retrieved, } log.info('Inserting item %s.', id) - (qmarks, bindings) = sqlhelpers.insert_filler(ITEMS_COLUMNS, row, require_all=True) - query = f'INSERT INTO items VALUES({qmarks})' + (qmarks, bindings) = sqlhelpers.insert_filler(row) + query = f'INSERT INTO items {qmarks}' cur.execute(query, bindings) log.loud('Inserted item %s.', id) else: