<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style='font-size:10pt;font-family:Verdana,Arial,Helvetica,sans-serif;'>Take a look at how it is done in the AequilibraE plugin.<br><br>I basically ship the plugin without the binaries and create a menu item where the user can choose to download the binaries.<br><br>Once downloaded, restarting the plugin allows it to identify the binaries and deactivate that menu item. <br><br>Cheers,<br>Pedro <div id="message"></div><br id="br3"><div id="signature"></div><div id="content"><br> ---- On Fri, 01 Apr 2022 05:00:02 +1000 <b> qgis-developer-request@lists.osgeo.org </b> wrote ----<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); padding-left: 6px; margin-left: 5px;"><div>Send QGIS-Developer mailing list submissions to
<br>    <a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a>
<br>
<br>To subscribe or unsubscribe via the World Wide Web, visit
<br>    <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
<br>or, via email, send a message with subject or body 'help' to
<br>    <a href="mailto:qgis-developer-request@lists.osgeo.org" target="_blank">qgis-developer-request@lists.osgeo.org</a>
<br>
<br>You can reach the person managing the list at
<br>    <a href="mailto:qgis-developer-owner@lists.osgeo.org" target="_blank">qgis-developer-owner@lists.osgeo.org</a>
<br>
<br>When replying, please edit your Subject line so it is more specific
<br>than "Re: Contents of QGIS-Developer digest..."
<br>
<br>
<br>Today's Topics:
<br>
<br>   1. Plugin dependency with binaries: 'best' way to guide user to
<br>      install? (Aron Gergely)
<br>   2. Unexpected results from GPKG table query using executeSql()
<br>      (Raymond Nijssen)
<br>   3. Re: Unexpected results from GPKG table query using
<br>      executeSql() (Alessandro Pasotti)
<br>   4. Re: Unexpected results from GPKG table query using
<br>      executeSql() (Raymond Nijssen)
<br>
<br>
<br>----------------------------------------------------------------------
<br>
<br>Message: 1
<br>Date: Thu, 31 Mar 2022 14:09:21 +0200
<br>From: Aron Gergely <<a href="mailto:aron.gergely@rasterra.nl" target="_blank">aron.gergely@rasterra.nl</a>>
<br>To: qgis-dev <<a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a>>
<br>Subject: [QGIS-Developer] Plugin dependency with binaries: 'best' way
<br>    to guide user to install?
<br>Message-ID: <5e3173ec<a href="mailto:-7b7e-64da-47d1-79d39edc1c10@rasterra.nl" target="_blank">-7b7e-64da-47d1-79d39edc1c10@rasterra.nl</a>>
<br>Content-Type: text/plain; charset=UTF-8; format=flowed
<br>
<br>Hi All,
<br>
<br>What would be a good practice to handle 3rd party libs which can't be 
<br>shipped together with a plugin?
<br>I am looking for the most user-friendly way and have an idea.
<br>But thought I would bounce it off the collective wisdom here and see if 
<br>there are other/better ways.
<br>
<br>If we find a 'best' method I could PR an update to the QGIS docs or 
<br>PyQGIS cookbook, etc to preserve that knowledge.
<br>
<br>Bit of context:
<br>I have a plugin that uses a 3rd party python library which has binaries.
<br>I would like to submit this plugin to the official plugin repository.
<br>According to <a href="https://plugins.qgis.org/publish/" target="_blank">https://plugins.qgis.org/publish/</a> it's not allowed to ship 
<br>binaries it with the plugin.
<br>In such case the above webpage recommends telling the end user to run 
<br>"pip.main(...)" from the python console to install missing libraries.
<br>
<br>I thought that's not user friendly and it's a pip hack (pip.main() is 
<br>meant to be internal).
<br>Also, I want to handle the missing python module in my plugin 
<br>gracefully: check on plugin load if missing, if so, guide user to 
<br>resolve, preferably without having them write or copy any commands.
<br>
<br>The idea:
<br>Using python's subprocess module from within the plugin to call the pip 
<br>CLI, which would install the package the usual pip way. Here's why:
<br>- pip project recommends this way as best practice, warns against the 
<br>pip.main()
<br>- user would not need to write or copy-paste commands
<br>- could make this user friendly: wire it in the plugin code to a push 
<br>button and build it into a dialog e.g.;? if lib is missing on plugin load,
<br> ? show a QMessageBox and let user open a dialog to resolve. In that 
<br>dialog would be the push button to trigger the pip install via subprocess.
<br>
<br>How would this play out multi-platform via subprocess, I have no idea of 
<br>yet - thought if the idea survived this thread, I'd go find out ;)
<br>
<br>Do you think this subprocess + pip is a good idea?
<br>Would it be allowed for plugins in the official repository to behave as 
<br>such?
<br>Anyone has other user-friendly ways of doing this?
<br>
<br>Best regards,
<br>Aron
<br>
<br>
<br>
<br>------------------------------
<br>
<br>Message: 2
<br>Date: Thu, 31 Mar 2022 18:09:25 +0200
<br>From: Raymond Nijssen <<a href="mailto:r.nijssen@terglobo.nl" target="_blank">r.nijssen@terglobo.nl</a>>
<br>To: qgis-developer <<a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a>>
<br>Subject: [QGIS-Developer] Unexpected results from GPKG table query
<br>    using executeSql()
<br>Message-ID: <bba11f52<a href="mailto:-a64a-6502-fbce-dbc986ba9391@terglobo.nl" target="_blank">-a64a-6502-fbce-dbc986ba9391@terglobo.nl</a>>
<br>Content-Type: text/plain; charset=UTF-8; format=flowed
<br>
<br>Hi devs,
<br>
<br>I'm working on a plugin that connects to a custom table (without 
<br>geometry) in a GPKG. When I'm sending queries to it, I keep on getting 
<br>unexpected results. Somehow the id field is missing, sometimes it 
<br>appears twice (!). And this seems to be different between QGIS 3.10 and 
<br>3.25. (I think it changed since 3.22).
<br>
<br>Here is a piece of my code:
<br>
<br>
<br>fn = '/path/to/test.gpkg'
<br>md = QgsProviderRegistry.instance().providerMetadata('ogr')
<br>conn = md.createConnection(fn, {})
<br>
<br>q = 'select * from test_table;'
<br>qr = conn.executeSql(q)
<br>print(qr) # No id field in result
<br>
<br>
<br>
<br>Before diving into the QGIS code I'd like to check if this is the way to 
<br>go. Or should i use another way to query that GPKG (SQLite) db?
<br>
<br>
<br>Kind regards,
<br>Raymond
<br>
<br>
<br>------------------------------
<br>
<br>Message: 3
<br>Date: Thu, 31 Mar 2022 18:15:00 +0200
<br>From: Alessandro Pasotti <<a href="mailto:apasotti@gmail.com" target="_blank">apasotti@gmail.com</a>>
<br>To: Raymond Nijssen <<a href="mailto:r.nijssen@terglobo.nl" target="_blank">r.nijssen@terglobo.nl</a>>
<br>Cc: qgis-developer <<a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a>>
<br>Subject: Re: [QGIS-Developer] Unexpected results from GPKG table query
<br>    using executeSql()
<br>Message-ID:
<br>    <CAL5Q670rrD--ZvEVDTtCWEqU1vZgUe7Nh<a href="mailto:+e58MLMDMQNPF9h1w@mail.gmail.com" target="_blank">+e58MLMDMQNPF9h1w@mail.gmail.com</a>>
<br>Content-Type: text/plain; charset="utf-8"
<br>
<br>Hi Raymond,
<br>
<br>your code looks good.
<br>
<br>Can you provide a test file?
<br>
<br>There are some test in core here:
<br><a href="https://github.com/qgis/QGIS/blob/master/tests/src/python/test_qgsproviderconnection_ogr_gpkg.py" target="_blank">https://github.com/qgis/QGIS/blob/master/tests/src/python/test_qgsproviderconnection_ogr_gpkg.py</a>
<br>
<br>
<br>On Thu, Mar 31, 2022 at 6:09 PM Raymond Nijssen via QGIS-Developer <
<br><a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a>> wrote:
<br>
<br>> Hi devs,
<br>>
<br>> I'm working on a plugin that connects to a custom table (without
<br>> geometry) in a GPKG. When I'm sending queries to it, I keep on getting
<br>> unexpected results. Somehow the id field is missing, sometimes it
<br>> appears twice (!). And this seems to be different between QGIS 3.10 and
<br>> 3.25. (I think it changed since 3.22).
<br>>
<br>> Here is a piece of my code:
<br>>
<br>>
<br>> fn = '/path/to/test.gpkg'
<br>> md = QgsProviderRegistry.instance().providerMetadata('ogr')
<br>> conn = md.createConnection(fn, {})
<br>>
<br>> q = 'select * from test_table;'
<br>> qr = conn.executeSql(q)
<br>> print(qr) # No id field in result
<br>>
<br>>
<br>>
<br>> Before diving into the QGIS code I'd like to check if this is the way to
<br>> go. Or should i use another way to query that GPKG (SQLite) db?
<br>>
<br>>
<br>> Kind regards,
<br>> Raymond
<br>> _______________________________________________
<br>> QGIS-Developer mailing list
<br>> <a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a>
<br>> List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
<br>> Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
<br>>
<br>
<br>
<br>-- 
<br>Alessandro Pasotti
<br>QCooperative:  www.qcooperative.net
<br>ItOpen:   www.itopen.it
<br>-------------- next part --------------
<br>An HTML attachment was scrubbed...
<br>URL: <<a href="http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220331/ad1ec7b7/attachment-0001.html" target="_blank">http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220331/ad1ec7b7/attachment-0001.html</a>>
<br>
<br>------------------------------
<br>
<br>Message: 4
<br>Date: Thu, 31 Mar 2022 18:52:48 +0200
<br>From: Raymond Nijssen <<a href="mailto:r.nijssen@terglobo.nl" target="_blank">r.nijssen@terglobo.nl</a>>
<br>To: Alessandro Pasotti <<a href="mailto:apasotti@gmail.com" target="_blank">apasotti@gmail.com</a>>
<br>Cc: qgis-developer <<a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a>>
<br>Subject: Re: [QGIS-Developer] Unexpected results from GPKG table query
<br>    using executeSql()
<br>Message-ID: <87330c53<a href="mailto:-a8a5-6e07-dd6e-006fcdd7710f@terglobo.nl" target="_blank">-a8a5-6e07-dd6e-006fcdd7710f@terglobo.nl</a>>
<br>Content-Type: text/plain; charset=UTF-8; format=flowed
<br>
<br>Hi Alessandro,
<br>
<br>Thanks for your reply. Will share data and a test script with you privately.
<br>
<br>Raymond
<br>
<br>
<br>On 31-03-2022 18:15, Alessandro Pasotti wrote:
<br>> Hi Raymond,
<br>> 
<br>> your code looks good.
<br>> 
<br>> Can you provide a test file?
<br>> 
<br>> There are some test in core here: 
<br>> <a href="https://github.com/qgis/QGIS/blob/master/tests/src/python/test_qgsproviderconnection_ogr_gpkg.py" target="_blank">https://github.com/qgis/QGIS/blob/master/tests/src/python/test_qgsproviderconnection_ogr_gpkg.py</a> 
<br>> <<a href="https://github.com/qgis/QGIS/blob/master/tests/src/python/test_qgsproviderconnection_ogr_gpkg.py" target="_blank">https://github.com/qgis/QGIS/blob/master/tests/src/python/test_qgsproviderconnection_ogr_gpkg.py</a>>
<br>> 
<br>> 
<br>> On Thu, Mar 31, 2022 at 6:09 PM Raymond Nijssen via QGIS-Developer 
<br>> <<a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a> <mailto:<a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a>>> 
<br>> wrote:
<br>> 
<br>>     Hi devs,
<br>> 
<br>>     I'm working on a plugin that connects to a custom table (without
<br>>     geometry) in a GPKG. When I'm sending queries to it, I keep on getting
<br>>     unexpected results. Somehow the id field is missing, sometimes it
<br>>     appears twice (!). And this seems to be different between QGIS 3.10 and
<br>>     3.25. (I think it changed since 3.22).
<br>> 
<br>>     Here is a piece of my code:
<br>> 
<br>> 
<br>>     fn = '/path/to/test.gpkg'
<br>>     md = QgsProviderRegistry.instance().providerMetadata('ogr')
<br>>     conn = md.createConnection(fn, {})
<br>> 
<br>>     q = 'select * from test_table;'
<br>>     qr = conn.executeSql(q)
<br>>     print(qr) # No id field in result
<br>> 
<br>> 
<br>> 
<br>>     Before diving into the QGIS code I'd like to check if this is the
<br>>     way to
<br>>     go. Or should i use another way to query that GPKG (SQLite) db?
<br>> 
<br>> 
<br>>     Kind regards,
<br>>     Raymond
<br>>     _______________________________________________
<br>>     QGIS-Developer mailing list
<br>>     <a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a> <mailto:<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a>>
<br>>     List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
<br>>     <<a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>>
<br>>     Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
<br>>     <<a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>>
<br>> 
<br>> 
<br>> 
<br>> -- 
<br>> Alessandro Pasotti
<br>> QCooperative: www.qcooperative.net <<a href="https://www.qcooperative.net" target="_blank">https://www.qcooperative.net</a>>
<br>> ItOpen: www.itopen.it <<a href="http://www.itopen.it" target="_blank">http://www.itopen.it</a>>
<br>
<br>
<br>------------------------------
<br>
<br>Subject: Digest Footer
<br>
<br>_______________________________________________
<br>QGIS-Developer mailing list
<br><a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a>
<br>List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
<br>Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
<br>
<br>
<br>------------------------------
<br>
<br>End of QGIS-Developer Digest, Vol 197, Issue 39
<br>***********************************************
<br></div></blockquote></div></div><br></body></html>