1

I used R to create a SQLite database and now I want to read from it (in parallel from multiple cores that have access to the same sqlite DB) multiple times and write to another DB multiple times, ~ 1,000 or more times in parallel. However, when I try doing such operation I get the following error:

sqliteFetch(rs, n = -1, ...) : 
RSQLite driver: (RS_SQLite_fetch: failed first step: database is locked)

In my script I am running the following two commands that I think are giving the error (not sure if it comes from the reading or the writing):

dbGetQuery(db1, sql.query) 
# later on...
if(dbExistsTable(db2, table.name){
dbWriteTable(db2, table.name, my.df, append = T)
} else {
dbWriteTable(db2, table.name, my.df)
}

Do you know if such operation is possible? If so, anyway to do it and avoid such error? I asked this question before and I was refered to ACID design of Databases, which make me think such operation should be possible but somehow it's not working.

I am also open to suggestions, such as oh you can use MySQL to do that, should work better, etc.

Thanks!

Dnaiel
  • 7,622
  • 23
  • 67
  • 126
  • http://stackoverflow.com/questions/4060772/sqlite3-concurrent-access – dickoa Jan 15 '14 at 19:29
  • @dickoa thanks. That slightly clarifies the issue, now the subsequent question is, should I move to MySQL and then I will be able to do it? or is there any solution to the issue? – Dnaiel Jan 15 '14 at 19:39
  • I personally think that Postgres is a "better" RDBMS than MySQL and you can use the excellent RPostgresSQL. But if for any reason you want to stick with MySQL try MariaDB instead. – dickoa Jan 15 '14 at 21:06

0 Answers0