Overwrite not working, wrong number of records returned

2624
12
02-05-2018 05:10 PM
TregChristopher
Occasional Contributor

I'm using Python API's flc.manager.overwrite method to overwrite an existing HFS with new data from a feat class in a fgdb. Although the operation says "success" the records returned are the either the same as before or they are zero.

To test, I downloaded a hosted feature service (HFS) as a fgdb, deleted a few records in ArcMap and then specified the following for overwriting. 

flc = arcgis.features.FeatureLayerCollection.fromitem(item)
flc

lyr = flc.layers[0]
lyr.query(return_count_only=True)

Output:39

flc.manager.overwrite(r"C:\data\Data\Projects\jupyter\WDFW_JupyterNotebooks_Master\Data\test.gdb\test_county")

Output:{'success': True}

lyr = flc.layers[0]
lyr.query(return_count_only=True)

Output:39 #this should be 34 since I removed some counties from the local feature class

A second test with adding new features in ArcMap and then running method gave the "success:true" message

but results returned was zero records.

Any ideas what I'm doing wrong?

0 Kudos
12 Replies
KellyTaylor
New Contributor III

Has this been resolved? Over a year later and I am having the same problem. Getting {'success': True} from my script, but none of the features have been updated and the feature layer's symbology goes back how it was when first published.

I am wondering if it has to do with trying to overwrite using a feature class which lives within a data set in a geodatabase. Any thoughts?

0 Kudos
TregChristopher
Occasional Contributor

Apparently I  haven't been using this much because I just tried again and it seemed unsuccessful...the record count remained the same between the original 2431 and the overwrite, which should now have 2434 records. I didn't check whether any changed attribute values were overwritten or remained the same but the lack of change to the record count would seem to indicate that nothing else was overwritten either.

This is a table in an SDE,so I don't think your source as a feature class in a file geodb is the problem. I did get a warning (not an error) that the dataframe (df) is being deprecated in favor of the spatial dataframe but since it was a warning, I don't think that is the error either.

I am now working off of Py API version 1.6.1

Now removing all records from taxo table... Pre-Truncate Feature count: 2431 Post-Truncate Feature count: 0
Now overwriting taxo table...
Post-Overwrite Feature count: 2431

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\feature.py:612: UserWarning: The SpatialDataFrame has been deprecated. `df` property will be removed as a future release. Use `sdf` instead.   warnings.warn(("The SpatialDataFrame has been deprecated. "


0 Kudos
AshleyHayes2
New Contributor III

For what it is worth, I am experiencing the same issue.  Drew described it pretty much perfectly, "the overwrite method essentially restores the Feature Service to its state when initially published, or last overwritten via desktop tools."

0 Kudos