AnsweredAssumed Answered

How to update a hosted table in AGOL using Python

Question asked by FranklinCountyPaGIS on Aug 1, 2019
Latest reply on Sep 9, 2019 by FranklinCountyPaGIS

I have been attempting to automate a process where I normally download CSVs from several different places, & manually overwrite the hosted tables in AGOL.  I'd like to automate this all in a script that I can schedule to run on a nightly basis.  (As background, the data feeds several metrics dashboards viewed by Admin.)

 

I have yet to get the hosted table to update in AGOL.  

 

1. Download updated CSV & Upload to Pandas dataframe

2. remove null rows & format date columns.

3. Export dataframe to new CSV.

4. Update hosted table in AGOL with new CSV.

 

When I view the hosted table, there are two different updated dates showing.  Picture attached.

 

The first shows the date I ran the script (today), but the second shows the date I manually overwrote / updated the table (yesterday).  

 

I had been following https://community.esri.com/thread/183390-arcgis-online-service-overwrite-using-python-api

 

below is what I have been using to update.

 

palTable = gis.content.get('28b7f819dce24647aebad88d04ff3815')  #This ets the hosted table in AGOL
palCSV = gis.content.get('65f1e32cda224199b6ec10c4139c2f1a')    #This gets the CSV in AGOL

palCSV.update({}, data=newCSV)  #This updates the CSV on AGOL
palTable.update({}, data=newCSV)  #This updates the hosted table on AGOL

 

Update the CSV & re downloading the file shows that it correctly updated itself.

 

Viewing the data on the hosted table shows that it has not updated itself.

 

Is there a way to "refresh" the table or a better syntax?

 

Thanks!

Outcomes