[QGIS-Developer] core API to fetch query output fields from SQL query?

Sandro Santilli strk at kbt.io
Fri Jan 10 01:02:18 PST 2020


On Fri, Jan 10, 2020 at 09:55:33AM +0100, Sandro Santilli wrote:
> On Thu, Jan 09, 2020 at 05:52:16PM +0100, Alessandro Pasotti wrote:
> 
> > This works for me:
> > 
> > vl = QgsVectorLayer( "dbname=qgis_tests host=localhost port=5432
> > key='__rid__' user=ale table=\"(SELECT row_number() OVER () AS __rid__, *
> > FROM (SELECT * FROM raster_columns) AS foo)\" schema=public", 'layer',
> > 'postgres')
> 
> Ok, I've taken this path [1]. My mistake was using .setDataSource, which
> insists in taking a geometry column name.
> 
> [1] xxxxx

And the commit is:
https://github.com/qgis/QGIS/pull/33225/commits/bf4ed9ad47223cd0f9c0b7d7d71c09c646f1bae6

--strk;


More information about the QGIS-Developer mailing list