Select to view content in your preferred language

Calls to FeatureLayer.edit_features() succeed, but new features are not saved.

257
6
Jump to solution
06-12-2024 12:30 PM
Labels (2)
rob_d
by
New Contributor II

I'm using GIS 10.3, according to arcgis.GIS.version (I know, IT needs to update things).

I've cloned a hosted feature layer in Portal, renamed the clone, and deleted all of its existing features. I'm now trying to use FeatureLayer.edit_features(adds=List[Feature]) to populate it.

Specifically - I'm calling the FeatureLayer.edit_features() method and passing the adds argument a list of arcgis.feature.Feature instances.

The returned results are always successful. However - none of the features are saved, and the layer is still empty in Portal.

I've triple checked to make sure I'm editing the correct feature layer, I've checked my user permissions, I've tried turning off change tracking, and nothing's worked. I'm at the end of my rope. Anyone have any suggestions?

0 Kudos
1 Solution

Accepted Solutions
EarlMedina
Esri Regular Contributor

Have you tried with a subset of the data? Like 1-2 features? Seems like a list of Feature objects should work, but I must admit I've only used  FeatureSet objects (and raw json to a much lesser extent). Unfortunately, the error handling is not great with that function so it can be hard to pinpoint the cause of failure. Sometimes it can be that a length of a string exceeds the limit allowed by a field or an issue with data types.


View solution in original post

0 Kudos
6 Replies
EarlMedina
Esri Regular Contributor

Have you tried with a subset of the data? Like 1-2 features? Seems like a list of Feature objects should work, but I must admit I've only used  FeatureSet objects (and raw json to a much lesser extent). Unfortunately, the error handling is not great with that function so it can be hard to pinpoint the cause of failure. Sometimes it can be that a length of a string exceeds the limit allowed by a field or an issue with data types.


0 Kudos
rob_d
by
New Contributor II

I have - I use batches of ~250 features, and it's always the same.

The problem is, I'm not getting any informative error messages. I've come to realize that the API will return:

  1. A success message if you pass it a valid feature and the feature is added.
  2. A failure message if you pass it a feature and it fails validation.
  3. No message if you pass it a valid feature and the feature is not added.

    It's pretty frustrating, tbh.

0 Kudos
EarlMedina
Esri Regular Contributor

Can you try that again, but way smaller?

I don't know if you are working from a dataframe, but another check would be just sending in the data with just a few fields. Just to narrow down the problem.

0 Kudos
rob_d
by
New Contributor II

Got it - thanks for the suggestion! I was able to add a feature with no attributes, so I must be getting attribute formatting/conversion errors somewhere (I'm guessing the date attributes).

I didn't think to check though, because I DO get some errors (mostly 10500 errors without descriptions, or  conversion errors for boolean attributes). Seems odd that no errors are raised in the vast majority of cases.

0 Kudos
MErikReedAugusta
Occasional Contributor III

Have you also ruled out any sort of database syncing issues?

I was running an arcpy operation involving UpdateCursor on an Enterprise database recently.  Everything looked to be successful, but no values updated.

Until I looked back the next day and all of the values did populate.  I thought I was going crazy, so I started doing some testing, and discovered that apparently because of the way our IT department had the database configured, direct/manual edits would go through immediately.  But edits queued through UpdateCursor & Editor (the latter is required when an SDE is involved) would disappear into some hidden back-end until the server re-synced every evening around midnight.

Further complicating matters: After the data finally appeared in SDE every next day, the time stamps also always showed the time I ran the code the previous day, not the time that the sync happened, which made it hard to troubleshoot, at first.

 

tl;dr
Run a test, note the time, and then don't touch it for 24 hours.  See if the behavior is the same, or if it changed.

rob_d
by
New Contributor II

So far, I've just had formatting issues that raised silent errors.

But I'll definitely keep this in mind if I run into more issues.

0 Kudos