This is a follow up to this question: Export vector layer to sqlite database using pyqgs
I am trying to import a QGIS polygon layer into a spatialite db. I was able to add a geometry column to my table using
cur.execute("SELECT InitSpatialMetadata()") cur.execute("SELECT AddGeometryColumn('Polygonx', 'geometry', 4326, 'POLYGON', 'XY')")
Subsequently, I am using the following line to insert my values, inlcuding the geometry
cur.executemany("INSERT INTO Polygonx VALUES (?,?,?,?)", feature_list)
feature_list =  for feature in vlyr.getFeatures(): attributes = feature.attributes() new_feature = (feature.id(), attributes, attributes, feature.geometry().exportToWkt()) feature_list.append(new_feature)
When using the db manager to check the table, however, the value of the geometry column is always NULL. Any idea what wrong with my code?