I am trying to add 2 lists to an INSERT command in Python.
I'm looking for the simplest smart method.
The DuckDb table is constructed with fields: Timestamp,Job, 10x real fields, 10x Boolean I know that this can be done with a for loop. But ca it be done more easy
def dyn_date_entry():
unix = time.time()
date2 = datetime.fromtimestamp(unix).strftime('%Y-%m-%d %H:%M:%S.%f')
answer = []
value = []
for i in range(0,10): #just for testing
value.append(random.randrange(0,100)/9.9) #just for testing
answer.append(True) #just for testing
job = random.randrange(0,100) #just for testing
#move to new row in database
conn.append('mytable',[date2,job,value,answer])
this give error
Invoked with: <duckdb.duckdb.DuckDBPyConnection object at 0x000002895A22C470>, 'mytable',
['2025-02-02 12:19:52.614415', 65, [0.7070707070707071, 3.333333333333333, 2.323232323232323,
6.4646464646464645, 7.777777777777778, 6.666666666666666, 9.595959595959595, 10.0,
4.848484848484849, 2.929292929292929], [True, True, True, True, True, True, True, True, True, True]]
So does anyone have an idea? My first method was #conn.execute('''INSERT INTO mytable VALUES(?,?,? 23 ? marks here)''',[date2,value[0]---until[10],answer[0] -- until[10] ---)