Hi Hannes,
so the only way to get the queries is to read what development panel is
listing when enabled?
I also found GDALDatasetSetQueryLoggerFunc:
https://github.com/qgis/QGIS/blob/master/src/core/providers/ogr/qgsogrfeatureiterator.cpp#L417
but seems not directly accessible with python
Cheers and thanks
Matteo
On 3/5/24 08:53, Johannes Kröger (WhereGroup) wrote:
Hi Matteo,
https://api.qgis.org/api/master/classQgsDatabaseQueryLog.html does have
appropriate signals (queryFinished and queryStarted, both include the
query) but it looks like they are not documented in the Python API
https://qgis.org/pyqgis/master/core/QgsDatabaseQueryLog.html
It *looks* like they are exposed though. So try
def do_something_with(query):
...
query_log = QgsApplication.databaseQueryLog()
query_log.queryFinished.connect(do_something_with)
If that does not work, maybe the debugging panel itself has a signal you
can connect to as a hacky workaround.
Cheers, Hannes
On 04.03.24 17:54, Matteo Ghetta via QGIS-Developer wrote:
Hi devs,
I'm looking for a way in pyqgis to catch the (raw) queries that QGIS
is sending to the PostgreSQL provider when a table is edited: for
example the raw "INSERT ... INTO ...", "UPDATE ...".
Basically what the Development Panel is listing when enabled. Is there
a way in pyqgis?
Cheers and thanks for any suggestion!
Matteo
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer