'Updates' Parameter is Invalid - An Item With the Same Key Has Already Been Added (Error Code: 400)

933
1
05-27-2019 10:50 AM
JeremyMullins1
New Contributor III

I am trying to update a feature layer with an updated CSV (detailed in this Sample Notebooks section of the ArcGIS API for Python documentation). Here is the code I have been using:

I have had no issues when testing various parameters (this is only part of a larger script that interacts with a SQL database; this section is dealing with the SQL query results as a CSV, preparing it for comparison/update to the feature layer).

While test running some code in Jupyter, there was a small syntax error right after this section. I fixed the syntax error, restarted the kernel, and ran the code. However, now I cannot seem to run the edit_features method any longer, instead receiving this error:

Did the kernel not clear this parameter? Is it stuck in some weird limbo between Jupyter and the feature layer that I can't figure out?

How do I remove the key to allow the updates parameter to function properly again, and what can I do in the future to ensure this doesn't happen?

1 Reply
sam-gartrell
New Contributor II

This same error was driving me insane yesterday. Like you, I was making edits to a spatial dataframe via pandas and trying to push them back up to the feature layer. Restarting the kernel and republishing the layer did nothing.

In my case, the cause of the error turned out to be a capitalization error when trying to access a field ("Status") in the SDF, resulting in the creation of a new field ("status"). I see some similar discrepancies in your dataframe indices; Perhaps they're true to the field names you're mapping together, but I would double-check "Descriptio", or the "BuildingID" capitalization differences.

0 Kudos