<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: FeatureLayer edit_features throwing error 1000: No mapping exists from object type System.Object[] to a known managed provider native type. in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/featurelayer-edit-features-throwing-error-1000-no/m-p/1328259#M8998</link>
    <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;Seems like your next step is to figure out which field(s) is causing the &lt;STRONG&gt;1000:&amp;nbsp;String or binary data would be truncated &lt;/STRONG&gt;error.&lt;/P&gt;&lt;P&gt;From there, you can either truncate the string yourself or increase the length of the string field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One way to figure out which fields are causing the issue is to create a dataframe from your input records, get the max length of all string columns, and compare that length to the field length:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# where 'df' is created from your input records
string_fields = [field for field in fl.properties.fields if field.type == "esriFieldTypeString"]
for field in string_fields:
    max_string_length = df[field.name].apply(lambda x: len(x)).max()
    if max_string_length &amp;gt; field.length:
        print(f"{field.alias}: length needs to meet or exceed {max_string_length}")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Sep 2023 13:48:54 GMT</pubDate>
    <dc:creator>EarlMedina</dc:creator>
    <dc:date>2023-09-13T13:48:54Z</dc:date>
    <item>
      <title>FeatureLayer edit_features throwing error 1000: No mapping exists from object type System.Object[] to a known managed provider native type.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/featurelayer-edit-features-throwing-error-1000-no/m-p/1326945#M8990</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Update:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;One of the fields was an integer type in the hosted feature service, and the input value from Knack was a string. I changed the field type, but it's still not working. New errors have arisen- one feature's error code is &lt;STRONG&gt;1003: Operation rolled back&lt;/STRONG&gt; and the other is &lt;STRONG&gt;1000:&amp;nbsp;String or binary data would be truncated. The statement has been terminated.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Original post:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I am working on updating a hosted feature service from a spatial data frame extracted from the Knack API. I used the Python API documentation example &lt;A href="https://developers.arcgis.com/python/guide/editing-features/#adding-features" target="_self"&gt;posted here.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Script snippet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;svc_lyr = svc_url + "/0"
ft_lyr = FeatureLayer(svc_lyr)
print(ft_lyr)

ft_set = ft_lyr.query(where="1=1")
if len(ft_set) &amp;gt; 0:
    print(ft_set.features[0])
    template_ = deepcopy(ft_set.features[0])
    print(template_)

input_features = []

add_ft = deepcopy(template_)

# records is a list of json records extracted from Knack API with
# attributes, similar to feature set features.
for r in records:
    add_ft.attributes['ProjectKey'] = r['ProjectKey']
    add_ft.attributes['ProjectName'] = r['ProjectName']
    
    latitude = r['Latitude']
    longitude = r['Longitude']

    add_ft.geometry = geometry.Geometry({"x" : longitude, "y" : latitude, "spatialReference" : {"wkid" : 4326}})

    input_features.append(add_ft)


ft_lyr = FeatureLayer(svc_lyr)

add_result = ft_lyr.edit_features(adds=input_features)
print(add_result)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the script, no data is added and I get the error:&lt;STRONG&gt; &lt;FONT face="courier new,courier"&gt;{'addResults': [{'objectId': 7, 'uniqueId': 7, 'globalId': None, 'success': False, 'error': {'code': 1000, 'description': 'No mapping exists from object type System.Object[] to a known managed provider native type.'}}], 'updateResults': [], 'deleteResults': []}&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'm not finding much about this error related to this edit_features function... but given that I'm taking a deepcopy() to create the feature template, I'm unsure how the mapping could be off...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any insights would be much appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2023 20:10:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/featurelayer-edit-features-throwing-error-1000-no/m-p/1326945#M8990</guid>
      <dc:creator>EmmaHatcher</dc:creator>
      <dc:date>2023-09-08T20:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer edit_features throwing error 1000: No mapping exists from object type System.Object[] to a known managed provider native type.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/featurelayer-edit-features-throwing-error-1000-no/m-p/1328259#M8998</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;Seems like your next step is to figure out which field(s) is causing the &lt;STRONG&gt;1000:&amp;nbsp;String or binary data would be truncated &lt;/STRONG&gt;error.&lt;/P&gt;&lt;P&gt;From there, you can either truncate the string yourself or increase the length of the string field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One way to figure out which fields are causing the issue is to create a dataframe from your input records, get the max length of all string columns, and compare that length to the field length:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# where 'df' is created from your input records
string_fields = [field for field in fl.properties.fields if field.type == "esriFieldTypeString"]
for field in string_fields:
    max_string_length = df[field.name].apply(lambda x: len(x)).max()
    if max_string_length &amp;gt; field.length:
        print(f"{field.alias}: length needs to meet or exceed {max_string_length}")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 13:48:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/featurelayer-edit-features-throwing-error-1000-no/m-p/1328259#M8998</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2023-09-13T13:48:54Z</dc:date>
    </item>
  </channel>
</rss>

