Overwrite or update hosted table with new fields

163
2
04-12-2021 12:48 AM
IonSola_Torralba
New Contributor

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)
oldcsvFLC.manager.overwrite('path')

I attach a subset of old and new CSV as an example

Tags (3)
0 Kudos
2 Replies
jcarlson
MVP Regular Contributor

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.

- Josh Carlson
Kendall County GIS
IonSola_Torralba
New Contributor

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.

0 Kudos