Sample Header Ad - 728x90

How to prevent SQLite from blocking while using R?

2 votes
1 answer
909 views
I am doing an infinity loop to keep gathering data from database **db**, rework it and send it to another database **db1** library(DBI) library(RSQLite) while(1==1){ db = dbConnect(SQLite(), dbname="Data.sqlite",synchronous = NULL) db1 = dbConnect(SQLite(), dbname="Data2.sqlite",synchronous = NULL) db1 db Column1=dbGetQuery(db,'select * from Table1') #Here is some calculations# Result = Column1/10 #Here calculations are finished and ready to be sent to new database# dbWriteTable(db1, name="Result", value=Result, row.names=TRUE, append=TRUE) dbDisconnect(db1) dbDisconnect(db) } when I run the code, it executes about 10 loops and then rise the following Error: *Error in rsqlite_send_query(conn@ptr, statement) : database is locked* Can someone please help me to solve this problem
Asked by Kingindanord (141 rep)
Dec 11, 2017, 12:09 AM
Last activity: Dec 12, 2017, 09:23 AM