Re: [QGIS-Developer] Unexpected results from GPKG table query using executeSql()

2022-04-06 Thread Raymond Nijssen via QGIS-Developer
Hi Alessandro, Thanks for looking into this! My QGIS-master + GDAL 3.0.4 returns the same result for that query. But in QGIS-master, when I try: q = 'SELECT *, edit_id FROM soilexc_edits ORDER BY edit_id' I get: [0, 1, PyQt5.QtCore.QDateTime(2022, 3, 1, 0, 0), 'test1', True] [1, 2, PyQt5.QtCo

Re: [QGIS-Developer] Unexpected results from GPKG table query using executeSql()

2022-04-06 Thread Alessandro Pasotti via QGIS-Developer
Hi Raymond, I tested your samples and I cannot reproduce the issue on QGIS master and GDAL 3.4. Here is the result of my query on your test file: In [13]: md = QgsProviderRegistry.instance().providerMetadata('ogr') ...: conn = md.createConnection('/home/x/Scaricati/soilext_db.gpkg', {})

Re: [QGIS-Developer] Unexpected results from GPKG table query using executeSql()

2022-04-01 Thread Alessandro Pasotti via QGIS-Developer
Hi Raymond, I'll have a look but keep in mind that for GPKG the implementation uses GDAL/OGR to execute the queries, there might be some fid/id handling that messes up with the returned fields. On Fri, Apr 1, 2022 at 8:28 AM Raymond Nijssen wrote: > For a workaround I found that selecting thi

Re: [QGIS-Developer] Unexpected results from GPKG table query using executeSql()

2022-03-31 Thread Raymond Nijssen via QGIS-Developer
For a workaround I found that selecting this way: SELECT edit_id + 0 AS edit_id, timestamp, name FROM ... The +0 seem to makes QGIS (or GDAL?) unaware of edit_id being the PK field and it does return it. Works both in 3.10 and 3.25. Raymond On 31-03-2022 18:15, Alessandro Pasotti w

Re: [QGIS-Developer] Unexpected results from GPKG table query using executeSql()

2022-03-31 Thread Raymond Nijssen via QGIS-Developer
Hi Alessandro, Thanks for your reply. Will share data and a test script with you privately. Raymond On 31-03-2022 18:15, Alessandro Pasotti wrote: Hi Raymond, your code looks good. Can you provide a test file? There are some test in core here: https://github.com/qgis/QGIS/blob/master/test

Re: [QGIS-Developer] Unexpected results from GPKG table query using executeSql()

2022-03-31 Thread Alessandro Pasotti via QGIS-Developer
Hi Raymond, your code looks good. Can you provide a test file? There are some test in core here: https://github.com/qgis/QGIS/blob/master/tests/src/python/test_qgsproviderconnection_ogr_gpkg.py On Thu, Mar 31, 2022 at 6:09 PM Raymond Nijssen via QGIS-Developer < qgis-developer@lists.osgeo.org>

[QGIS-Developer] Unexpected results from GPKG table query using executeSql()

2022-03-31 Thread Raymond Nijssen via QGIS-Developer
Hi devs, I'm working on a plugin that connects to a custom table (without geometry) in a GPKG. When I'm sending queries to it, I keep on getting unexpected results. Somehow the id field is missing, sometimes it appears twice (!). And this seems to be different between QGIS 3.10 and 3.25. (I t