python - Inserting rows while fetching(from another table) in SQLite -


I am getting this error, even if there are any pythons and sqlite. Operation Error: Can not Transaction - SQL statement in progress

  file "addbooks.py", line 77, savebook conn.commit () sqlite3. Pre> 

The code looks like this:

  conn = sqlite3.connect (fname) cread = conn.cursor () cread.execute ('' from book_text '' '' '' Select) While true: line = Cread.fetchone () if the line is none: for entry into brake .... getEntries (doc): saveBook (entry, conn)  

A fetchall () can not because the table and column size is large, and memory is rare is.

What can be done without resorting to dirty tricks (to get rows in memory, which will probably fit, and then the rows one by one).

The problem is that you have left the connection in the automatic mode, Wrap it up so that you get committed after all the updates are made, and it all works well.


Comments