I wish to update a column in a Spatialite table from a dictionary object using the pysqlite module in Python 2.7. I am accustomed to executing this operation on ordinary, i.e., non-spatial SQLite database thusly:
from pysqlite2 import dbapi2 as sqlitecon = sqlite.connect("db.sqlite")cur = con.cursor()for key, val in dict.iteritems(): cur.execute(''' UPDATE table SET field_to_update = ? WHERE id_field = ?; ''',(val,key))con.commitcon.close When I attempt to perform this operation on a Spatialite database I get:
OperationalError: no such function: GeometryConstraintsWhen I attempt the update with the spatial extension enabled, I do not receive an error message, but the field does not get the update. Further, the database is locked for use via the Spatialite GUI (InsertIntoLog: database is locked). Any suggestions? I know I can create a new schema and table, but that's a tedious workaround for updating large tables.
أكثر...
from pysqlite2 import dbapi2 as sqlitecon = sqlite.connect("db.sqlite")cur = con.cursor()for key, val in dict.iteritems(): cur.execute(''' UPDATE table SET field_to_update = ? WHERE id_field = ?; ''',(val,key))con.commitcon.close When I attempt to perform this operation on a Spatialite database I get:
OperationalError: no such function: GeometryConstraintsWhen I attempt the update with the spatial extension enabled, I do not receive an error message, but the field does not get the update. Further, the database is locked for use via the Spatialite GUI (InsertIntoLog: database is locked). Any suggestions? I know I can create a new schema and table, but that's a tedious workaround for updating large tables.
أكثر...