SQLite parallel insert

Dear ROOTers
Is there an way to insert records to sqlite database in parallel mode (e.g. many jobs in farm)? I found some examples in sqlite3 API that check if DB is locked or not, but I can’t see similar functions in ROOT API.

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Hi @dwielane ,
what ROOT API are you using to work with sqlite3 files?


Im using this ROOT TSQL classes. I saw some solutions that use “raw” sqlite library.

I see, then @linev might know whether we have a way to do parallel writes with the TSQL* classes

How these solutions looks like?
Is it special SQL requests or special API calls?

P.S. I had no experience with SQLite till now. But I hope it is possible to use/extend TSQLServer API if necessary

Actually I thougt about transactions, they can be done via current root interface (I suppose) but I would like also check the status of transactions by using sqlite3_get_autocommit but I don’t see such option in ROOT.

It sounds like you might want to use sqlite3 directly, ROOT’s interfaces will probably never offer the same amount of features.


In TSQLServer class there are three methods to control transactions:
StartTransaction(), Commit(), Rollback()

Only first method is implemented for TSQLiteServer class.
There is no problem to add implementation for remaining two - API is very simple and can be read here: BEGIN TRANSACTION - Using SQLite [Book]

And one can introduce extra method like TSQLServer::IsTransaction() which will use sqlite3_get_autocommit function inside.

I can provide PR. @dwielane, will you be able to test it?


Here is PR with proposed changes, please test it before I can commit it into the master

1 Like

Did you check that new methods work for you?
Can I merge PR?

Dear @linev ,
I have collaboration meeting this week so I will not be able to check this solution today, could I answer in next week?

No problem, next week is absolutely ok

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

@dwielane any news here?

This topic was automatically closed after 13 days. New replies are no longer allowed.