A
A
Andrey Romanov2021-10-22 08:54:02
Python
Andrey Romanov, 2021-10-22 08:54:02

How to handle SQLlite error?

Good day friends.
I am getting data from an array and update it via UPDATE with rows in db by name value.
Sometimes, new entries appear and I don't need to update them, but add them. How to intercept (as it is called) an error that will help me identify that there is no entry in the database with such a name, it needs to be added.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2021-10-22
@roni43

when updating, you should get back the number of changed records cursor.rowcount , so look and yes, 0 is not an error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question