Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
cursor = db.execute('SELECT * FROM table_name WHERE (id IS ? AND name IS ?)', (id, name))
row = cursor.fetchone()
if row is None:
cursor = db.execute('INSERT INTO table_name (id, name) VALUES (?,?)', (id, name))
db.commit()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question