Look at the difference in your print statement values and your insert values.
This works. You should remove the - in your barcode. It was giving problems.
This works. You should remove the - in your barcode. It was giving problems.
#! /usr/bin/env python3 import sqlite3 query = 'create table tbl_scans(barcode varchar, station varchar, attempt varchar5, scan_date varchar)' conn = sqlite3.connect('mydb.db') cursor = conn.cursor() conn.execute(query) conn.commit() values= {} values['barcode'] = 'MAD987654' values['station'] = 1 values['attempt'] = 1 values['scan_date'] = '2020-07-20 05:51:59' print(values) mylist = (values['barcode'], values['station'], values['attempt'], values['scan_date']) query = f'insert into tbl_scans (barcode, station, attempt,scan_date) values(?,?,?,?)' conn.execute(query, mylist) conn.commit() conn.close()
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags