I am trying to update a hosted table in AGOL (published from a CSV). The updated CSV has the same name and structure except a new field. When I try to update or overwrite the table, both manually from AGOL and using script with Python API the new field is not added to the hosted table.
I also tried to add the field (both manually from AGOL and using 'Add field' in Python) prior to the overwritting but when I overwrite the new field dissapears.
# Overwrite CSV
oldcsv = gis.content.get('itemid')
oldcsvFLC = FeatureLayerCollection.fromitem(oldcsv)
I attach a subset of old and new CSV as an example
Changing the schema during an overwrite can lead to problems. It is technically possible, but the docs themselves advise against this.
4. The schema (column names, column data types) of the data_file should be the same as original. You can have additional or fewer rows (features).
Try adding the field to your hosted layer first, then overwriting.
Thank you, but I already tried that, and it didn't work. I add the field to my hosted layer with no problem, but after the overwrite this new field dissapears again.
The overwriting works fine from ArcGIS PRO if the original table was shared from ArcGIS PRO too, but when I try to overwrite a table in AGOL which was published from a CSV the overwriting doesn't create new fields.