[Qgis-developer] Is it possible to read a OGR datasource with EXecuteSQL statement?

Hugo Mercier hugo.mercier at oslandia.com
Thu Mar 27 07:52:59 PDT 2014

Le 27/03/2014 14:19, Régis Haubourg a écrit :
> Hi, 
> I'm trying to developp a processing script that would save a lot of
> complexity if I could open in qgis a ogr datasource using ExecuteSQL
> statement. 
> I'm reading my datasources with OGR python API with no problem, and a simple
> SQL allows me to keep only one fields, and calculate on the fly area, maybe
> intersections between ogr layers. 
> I would like to know if it is possible to dynamically load that OGR
> datasource as a QGIS layer, or if I have no other choice than writing a temp
> file somewhere.. 

Apparently there is no way to access to the underlying OGR datasource
object for a QgsOgrProvider.
So you'll have to use an OGRVRT.

It seems we really need to have such a mechanism in QGIS (using
Spatialite virtual tables for instance as discussed on this ML earlier)
... :)

Hugo Mercier

More information about the Qgis-developer mailing list