Overwrite or update hosted table with new fields

655
3
04-12-2021 12:48 AM
IonSola_Torralba
New Contributor II

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)
3 Replies
jcarlson
MVP Frequent 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 II

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.

LARAPAdmin
New Contributor II

Hey, I have also experienced this exact issue. My only solution has been to recreate everything to add the new field(s). This method is not ideal and is super time consuming. Have you been able to find a workaround or an alternative solution?

Thanks!

0 Kudos