0
tableName = entityName + 's'
columnName = entityName
cursor.execute('SELECT rowid FROM ' + tableName + ' WHERE ' + columnName + ' = ?', (text,))
row = cursor.fetchone()
if row:
    return row[0]
else:
    cursor.execute('INSERT INTO ' + tableName + ' (' + columnName + ') VALUES (?)', (text,))
    return cursor.lastrowid

Error:- cursor.execute('SELECT rowid FROM ' + tableName + ' WHERE ' + columnName + ' = ?', (text,)) sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 15596 and this is thread id 10564.

how i can solve this error.

jrswgtr
  • 2,287
  • 8
  • 23
  • 49
  • 1
    [Edit] the question and tag the host language, presumably Python. – sticky bit Mar 01 '20 at 08:10
  • Does this answer your question? [ProgrammingError: SQLite objects created in a thread can only be used in that same thread](https://stackoverflow.com/questions/48218065/programmingerror-sqlite-objects-created-in-a-thread-can-only-be-used-in-that-sa) – DinoCoderSaurus Mar 02 '20 at 23:12

0 Answers0