vendredi 16 octobre 2015

Checking existence of element in SQlite db in Python

I am trying to check whether there is already an element within an sqlite database with a specific value (email) and am having some trouble.

def exists(this_email):
  cursor.execute("SELECT email FROM login WHERE email = ?", (this_email,)) 
  exists = cursor.fetchone()
  if exists is None:
    return 0
  else:
    return 1

I am getting an error:

"ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id -1219602688 and this is thread id -1230054592"

and am at a loss as to what this means!

Any help appreciated!

Aucun commentaire:

Enregistrer un commentaire