import sqlite3 import sys from sqlite3 import Error def create_connection(db_file): """ create a database connection to the SQLite database specified by db_file :param db_file: database file :return: Connection object or None """ conn = None try: conn = sqlite3.connect(db_file) except Error as e: print(e) return conn def create_res(conn, task): """ Create a new task :param conn: :param task: :return: """ #the proper table needs to be below, as well as all the parameters for said function #make sure the number of parameters matches up #TODO:: fix sql statement below sql = ''' INSERT INTO TABLE_NAME(parameter_type, trapped,testname, testnum, RigID) VALUES(?,?,?,?,?) '''#replace "TABLE_NAME" with your table cur = conn.cursor() cur.execute(sql, task) return cur.lastrowid def main(t1,t2,t3,t4,t5): database = "/home/pi/Documents/MiniLeia/MiniLeia.db" #this is a sample path, please insert your file's path # create a database connection conn = create_connection(database) with conn: # tasks task_1 = (t1, t2, t3, t4, t5) # create tasks create_res(conn, task_1)