[Qgis-developer] Editing groups of layers / edit buffer / transactions

Marco Hugentobler marco.hugentobler at sourcepole.ch
Tue Jun 3 02:50:19 PDT 2014


Hi devs

In the QGEP project (https://github.com/qgep/QGEP), we are trying to 
create a waste water application module based on PostgreSQL and QGIS. 
Other examples of application modules are GIS based solutions for water, 
electicity, gas, ... So what I'm describing here is valid for a large 
number of GIS based applications.

In an application module, there is usually a complex database schema 
consisting of many tables, views, triggers, foreign keys, constraints, 
sql functions. We found, that it is very difficult to do editing with 
the standard QGIS tools. In QGIS, we have an isolated edit buffer per 
layer. Once editing is stopped, the edits of a layer are commited to the 
datasource. For normal edit tasks, this is a great thing. However with 
many relations between the layers, it is almost impossile to work 
without triggering a lot of constraint violations in the database. Also 
adding or removing an object is usually done with sql functions, because 
it means changes to a lot of tables. In QGEP, we would more like to work 
within a database transaction and commit / rollback a series of changes 
at once (after all, a database snapshot can be seen as an edit buffer on 
database side).

A possibility to cope with such a special editing situation is to bypass 
the edit buffer in QGIS and redirect all the read/write access of the 
involved database providers through one connection (but only if this 
mode is activated e.g. by a plugin, normally edit buffer and providers 
will behave like now). I've submitted a pull request about that topic 
and there was quite a long discussion about it, but without a clear 
result. Therefore I'd like to discuss in a broader context (and 
separated from any implementation issues) the idea of bypassing the edit 
buffer (in special situations) and using a backend mechanism instead 
(e.g. db transactions).

What are your opinions?

Regards,
Marco

-- 
Dr. Marco Hugentobler
Sourcepole -  Linux & Open Source Solutions
Weberstrasse 5, CH-8004 Zürich, Switzerland
marco.hugentobler at sourcepole.ch http://www.sourcepole.ch
Technical Advisor QGIS Project Steering Committee



More information about the Qgis-developer mailing list