-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add read only mode #214
Add read only mode #214
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #214 +/- ##
=======================================
Coverage 82.93% 82.93%
=======================================
Files 37 37
Lines 4226 4226
=======================================
Hits 3505 3505
Misses 721 721 ☔ View full report in Codecov by Sentry. |
I think that when we use load_db it is also worth it to set a busy timeout. |
sqlite_db = SQLite.DB(database_path) | ||
|
||
DBInterface.execute(sqlite_db, "PRAGMA busy_timeout = 5000;") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be a good idea to create a function here to wrap this repeated code.
This PR allows the user to load a database in "Read only" mode.
Currently, we have two dispatches for
PSRI.load_study
, one that applies a migration first (if needed), and another that just loads the database.When applying a migration, the database should not be in "Read only" mode, so for the second dispatch, I have added a boolean parameter (default = false) that sets the loading mode.
So when a user uses
they can only perform reading queries and cannot modify the database.