According to the example below, you can use FeatureCollection. manager.overwrite to wholesale overwrite a feature layer you have hosted on AGOL -- or perhaps this is only an option for the Enterprisers? But, the example is built in terms of csv's stored locally on one's own hard drive. I have a spatial dataframe that I am pushing directly to AGOL without making any local shapefile or anything (sdf.spatial.to_featurelayer).
As I am regularly updating the sdf, I'd like to overwrite the hosted feature layer directly and often. Can that be done? The docs say, "Only hosted feature layer collection services can be overwritten" and I get about as far as "hosted feature layer . . . " before I don't know what that phrase means.
Overwrite the feature layer
Let us overwrite the feature layer using the new csv file we just created. To overwrite, we will use the overwrite() method.
In [21]:
from arcgis.features import FeatureLayerCollection
cities_flayer_collection = FeatureLayerCollection.fromitem(cities_item)
In [22]:
#call the overwrite() method which can be accessed using the manager property
cities_flayer_collection.manager.overwrite(os.path.join('data', 'updating_gis_content',
'updated_capitals_csv', 'capitals_1.csv'))