Hi people: I'm trying to update an table sqlite not geometric but the update does not take place.
this is my code: def convert_table(self): cfg_rel_path = os.path.join(os.sep, 'HFF_DB_folder', 'config.cfg') file_path = '{}{}'.format(self.HOME, cfg_rel_path) conf = open(file_path, "r") con_sett = conf.read() conf.close() settings = Settings(con_sett) settings.set_configuration() if settings.SERVER == 'sqlite': sqliteDB_path = os.path.join(os.sep, 'HFF_DB_folder', settings.DATABASE) db_file_path = '{}{}'.format(self.HOME, sqliteDB_path) uri = QgsDataSourceUri() uri.setDatabase(db_file_path) uri.setDataSource('','eamena_table', None,'') layerEamena=QgsVectorLayer(uri.uri(), 'eamena_table', 'spatialite') QgsProject.instance().addMapLayers([layerEamena], True) layer = QgsProject.instance().mapLayersByName('eamena_table')[0] with edit(layer): for feat in layer.getFeatures(): a=str(feat['assessment_investigator_actor']) if "[['" not in a and a!='NULL': t=a.replace(a[0],"[['"+a[0]).replace("|","'], ['").replace(a[-1],a[-1]+"']]") layer.updateFeature(feat) QgsProject.instance().removeMapLayer(layer.id()) If I print the results it's ok but into table doesn't update. Some one has some suggestions? Best E -- Enzo Cocca PhD in "Science and Technology for Archaeology and Cultural Heritage" ISMEO International Association of Mediterranean and Oriental Studies mail: enzo....@gmail.com cell: +393495087014
_______________________________________________ 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