Closed willp closed 2 years ago
That sounds like a good idea and should be supported: https://github.com/mattn/go-sqlite3#connection-string I will tinker a bit with the plugin to and probably add some fields in the Data Source Setting page in Grafana for this
Looks like it was quite a small change.
Why don't you check out this release and see if this works for you: https://github.com/fr-ser/grafana-sqlite-datasource/releases/tag/v2.2.0-rc.1
I might try to also check this version out a bit more and if I find no bugs I will probably release it in the coming weeks as a final version
Thanks for the fast turnaround! I'm testing it now and will ping back if I run into any trouble. So far, adding mode=ro to my options is working fine. I'll do some more testing but it's looking really good. Thanks!!
The new plugin version is released: https://github.com/fr-ser/grafana-sqlite-datasource/releases/tag/v2.2.0
Would it work to open the sqlite db in readonly mode by adding
+"?mode=ro"
todbPath
? (possibly needing to prefix with "file:" as well, so"file:" + dbPath + "?mode=ro"
) at sql.Open(...) in fetchData():https://github.com/fr-ser/grafana-sqlite-datasource/blob/15830484fcceb0fd6f63f51d4c85daceec312091/pkg/query.go#L240
I don't have a build environment to test with, I'm afraid.
Just curious if readonly mode would work, and possibly be a benefit... and maybe a good default?
It looks like go-sqlite3 v1.14.4 uses sqlite library 3.33.0 which supports readonly mode for WAL type databases (added in sqlite 3.22.0), so it seems like it should work for readonly WAL-type dbs, unless I've misinterpreted the dependencies' versions.