qgis-bridge-plugin icon indicating copy to clipboard operation
qgis-bridge-plugin copied to clipboard

QgsDataSourceUri is not hashable anymore in QGIS 3.42

Open GeoSander opened this issue 7 months ago • 0 comments

In QGIS 3.42.2 (Münster), this error appears when publishing to a file-based datastore (which causes data to be exported as GeoPackage):

TypeError: unhashable type: 'QgsDataSourceUri'

Traceback (most recent call last):
  File "C:\Users/XXX/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\geocatbridge\ui\publishwidget.py", line 771, in publish
    task = self.getPublishTask(self.parent, to_publish)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users/XXX/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\geocatbridge\ui\publishwidget.py", line 875, in getPublishTask
    return PublishTask(to_publish, self.fieldsToPublish, style_only, geodata_server, metadata_server, parent)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users/XXX/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\geocatbridge\publish\tasks.py", line 51, in __init__
    self._geopackager = GeoPackager(layer_ids, field_map)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users/XXX/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\geocatbridge\publish\export.py", line 179, in __init__
    self._gpk_id_map.setdefault(uri_key, set()).add(layer_id)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unhashable type: 'QgsDataSourceUri'

The above happened on a PostGIS layer. It is confirmed that 3.40 LTR (Bratislava) does not have this issue.

We need to investigate what has changed in QGIS what causes the QgsDataSourceUri to no longer be hashable and fix this appropriately.

[Reported by Mathieu Villemont of naomis.fr]

GeoSander avatar May 07 '25 09:05 GeoSander