You need to write t back to the feature, e.g. by
feat['assessment_investigator_actor'] = t
Greetings,
Benjamin
On 2021-05-04 19:59, Enzo Cocca wrote:
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 [1]())
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
--
--
Benjamin Jakimow, Doctoral Researcher
Earth Observation Lab | Geography Department | Humboldt-Universität zu
Berlin
e-mail: benjamin.jaki...@geo.hu-berlin.de
phone: +49 (0) 30 2093 6894
mobile: +49 (0) 157 5656 8477
fax: +49 (0) 30 2093 6848
mail: Unter den Linden 6 | 10099 Berlin | Germany
room: 2'222
Links:
------
[1] http://layer.id
_______________________________________________
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