[Qgis-user] Readonly gpkg
pergler at gmail.com
pergler at gmail.com
Tue Jan 11 16:01:24 PST 2022
Even Rouault <even.rouault at spatialys.sys> writes:
> The default enabling of WAL even in initial read-only access mode is
> to avoid that potential issue.
>
> There are currently way of disabling WAL (for advanced users) :
>
> - setting the OGR_SQLITE_JOURNALenvironment variable to JOURNAL
> - or setting the QGIS setting "qgis/walForSqlite" to false
>
> See
>
https://github.com/qgis/QGIS/blob/master/src/core/providers/ogr/qgsogrprovid
erutils.cpp#L1005
Greg Troxel <gdt at lexort.com> writes:
> Thanks for the pointers; I think I am beginning to follow.
> The use of WAL is a persistent property of a database. Clients use it
> or not when connecting, normally.
> As it is, qgis (by default) forces WAL mode, even if the database was
> not already in WAL, and even if there are other connections open. Or
> it forces DELETE mode, similarly without checking. So the concern
> about upgrading/downgrading comes from any setting of mode by any
> connection and any other existing connection.
> After digesting it all, I am left thinking that whether to use a
geopackage in WAL mode or DELETE mode is a user decision, ...
> Therefore, I think the right approach is:
> 1) let the user do "pragma JOURNAL_MODE=WAL;" if they want
> 2) when opening the database, don't do anything about JOURNAL_MODE;
just use it the way it is set.
You've left me in the dust, which is fine. But it sounds that
A. Ideally WAL/DELETE would be a connection (in the sense of the Browser
connections list)
level decision changeable by the user, not a layer-level decision and not
(as now)
an application setting used for all gpkg connections. In the distant future,
I could see
the Browser providing a UI wrapper to send the right pragma JOURNAL_MODE if
user requests.
B. Currently, one option would be for me/others to set qgis/walForSqlite to
false, which would
solve the problem for readonly gpkgs and only slightly downgrade performance
for
(modest-sized) writeable gpkg primarily edited via the canvas.
C. Alternately, continuing to let QGIS use WAL, but setting the specific
.gpkg file to be
read-only in the file system is a harmless if crude solution (as long as I
have no
intention of actually editing the layers in that gpkg).
Do I have that right? Thanks!
Martin
More information about the Qgis-user
mailing list