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

Tim Sutton tim at kartoza.com
Fri Jan 10 00:30:33 PST 2020


Oops sorry I didn't read it carefully enough!

Regards

Tim


On Fri, Jan 10, 2020, 8:03 AM Alessandro Pasotti <apasotti at gmail.com> wrote:

>
>
> On Thu, Jan 9, 2020 at 11:26 PM Tim Sutton <tim at kartoza.com> wrote:
>
>>
>>>
>>> In particular, me an Nyall have been chatting about adding a method to
>>> factory a QgsVectorLayer from a generic SQL query, the issues I see is that
>>> we need a PK (at least for PG) and how to decide the geometry column if
>>> there are more than one.
>>>
>>
>> I wonder if you could just transparently add row_number[1] to the query
>> to give each row a unique id?
>>
>> Regards
>>
>> Tim
>>
>> [1] https://www.postgresqltutorial.com/postgresql-row_number/
>>
>>
>
> Hi Tim,
>
> the example query I pasted in my original email does exactly that:
> (SELECT row_number()....
>
> we just need a bit of login to determine when/if we have to make that
> trick.
>
>
> --
> Alessandro Pasotti
> w3:   www.itopen.it
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200110/6edea5f5/attachment-0001.html>


More information about the QGIS-Developer mailing list