Insert Null in SQLite3 in Python

I am trying to insert a None value in the string entry of my db. table present exists

 db.execute("INSERT INTO present VALUES('test', ?, 9)", "This is a test!") db.execute("INSERT INTO present VALUES('test2', ?, 10)", None) 

but I get the error:

 ValueError: parameters are of unsupported type 

how to insert an empty value for the second field in a row?

+6
source share
1 answer

Use the tuple, IE:

 db.execute("INSERT INTO present VALUES('test2', ?, 10)", (None,)) 
+17
source

Source: https://habr.com/ru/post/958840/


All Articles