Bug report #14454

Invalid SQL error when using dataProvider().changeAttributeValues()

Added by Daan Goedkoop over 6 years ago. Updated over 6 years ago.

Category:Data Provider/SpatiaLite
Affected QGIS version:2.14.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:22432


I have a script that updates values in a Spatialite layer. It basically works like this:

idValue1 = spatialite_layer.dataProvider().fields().indexFromName( 'Value1' )
idValue2 = spatialite_layer.dataProvider().fields().indexFromName( 'Value2' )

updateMap = {}
for feat in selfeats:
  value1 = ...
  value2 = ...
  updateMap[ feat.id() ] = { idValue1 : value1, idValue2 : value2 }

spatialite_layer.dataProvider().changeAttributeValues( updateMap )

In QGIS 2.12 the script works fine. In version 2.14 I get this error:

SQLite Error: near "WHERE": syntax error SQL:


#1 Updated by Nyall Dawson over 6 years ago

  • Status changed from Open to Feedback

Can you test with master? There's been a possibly related fix for this recently.

#2 Updated by Daan Goedkoop over 6 years ago

  • Status changed from Feedback to Closed

Yes, it looks like it has been fixed in master.

Also available in: Atom PDF