<?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: edit_features Succeeds but doesn't add some attributes in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/edit-features-succeeds-but-doesn-t-add-some/m-p/1555250#M10847</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/10527"&gt;@JakeSkinner&lt;/a&gt;, thank you for your response.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I first read in my data from SQL db as a Pandas Dataframe:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nate0102_0-1730754001261.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/118803i227A0EF4FE2ABE7D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nate0102_0-1730754001261.png" alt="nate0102_0-1730754001261.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then iterate through the rows to create the list of dictionaries (the edits).&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Prepare the data to be added to the lookup table by iterating through dataframe rows
lookup_lga_class_data = []
for index, row in df_arcade_lookup_lga_class.iterrows():
    lookup_lga_class_data.append({
        "attributes": {
            "lga": row["lga"],
            "scientificName": row["scientific_name"],
            "classificationLocal": row["classification_local"],
            "localScientific": row["local_scientific"]
            }
        })

lookup_pwd_data = []
for index, row in df_arcade_lookup_pwd.iterrows():
    lookup_pwd_data.append({
        "attributes": {
            "commonName": row["common_name"],
            "scientificName": row["scientific_name"],
            "wons": row["wons"],
            "waStateDeclared": row["wa_state_declared"],
            'qldStateDeclared': None,
            'nswStateDeclared': None,
            'vicStateDeclared': None
            }
        })

# test to make sure dictionary has populated correctly (it does).
lookup_lga_class_data[:2]
lookup_pwd_data[:2]

# delete the existing features
ft_lookup_lga_class.delete_features(where="1=1")

# add the edits
ft_lookup_pwd.edit_features(adds=lookup_pwd_data)
ft_lookup_lga_class.edit_features(adds=lookup_lga_class_data)&lt;/LI-CODE&gt;&lt;P&gt;The main difference I can see between our code is that I edit_features in one line by adding the whole list in, instead of a for loop.&lt;/P&gt;&lt;P&gt;Thanks again for your time.&lt;/P&gt;&lt;P&gt;Nathan&lt;/P&gt;</description>
    <pubDate>Mon, 04 Nov 2024 21:09:50 GMT</pubDate>
    <dc:creator>nate0102</dc:creator>
    <dc:date>2024-11-04T21:09:50Z</dc:date>
    <item>
      <title>edit_features Succeeds but doesn't add some attributes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/edit-features-succeeds-but-doesn-t-add-some/m-p/1551694#M10792</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Issue summary&lt;/STRONG&gt;&lt;/EM&gt;:&amp;nbsp;feature_table.edit_features(add=[...]) adds correct number of records but ONLY attributes for single column come through to the hosted feature table. Everything else other than scientificName is blank. My fields are mapped correctly from python dictionary to Hosted Table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With Python, I am trying to update all records in two AGO Hosted Tables using "feature_table.edit_features(adds=)".&lt;/P&gt;&lt;P&gt;My process is:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;delete all features - feature_table.delete_features(where="1=1")&lt;/LI&gt;&lt;LI&gt;get the data prepared - list of dictionaries as below example&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;[{'attributes': {'lga': 'test',
   'scientificName': 'Acacia longifolia',
   'classificationLocal': 'Very High Priority',
   'localScientific': 'Acacia longifolia'}},
 {'attributes': {'lga': 'test',
   'scientificName': 'Amaryllis belladonna',
   'classificationLocal': 'High Priority',
   'localScientific': 'Amaryllis belladonna'}}]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Add the list to the Hosted table&lt;BR /&gt;I get all success, no errors.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{'addResults': [{'objectId': 1016,
   'uniqueId': 1016,
   'globalId': '2E655834-2E92-4A57-8F8B-2697122C1DE6',
   'success': True},
  {'objectId': 1017,
   'uniqueId': 1017,
   'globalId': 'F09D7D37-98A9-4364-9D9F-35CC8151FA9E',
   'success': True}],
 'updateResults': [],
 'deleteResults': []}​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;ISSUE: only Scientific name data comes through... other fields are blank.&lt;BR /&gt;This same issue happens on&amp;nbsp;two tables i.e. scientific name comes through, everything else blank. It doesn't matter if I do all records or just a subset (two in the examples below).&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nate0102_0-1729743623897.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/117988i349A936AAC3913BE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nate0102_0-1729743623897.png" alt="nate0102_0-1729743623897.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Extra info... Hosted Table fields:&lt;/P&gt;&lt;P&gt;{'OBJECTID': 0, 'scientificName': 1, 'lga': 2, 'classificationLocal': 3, 'localScientific': 4, 'GlobalID': 5}&lt;BR /&gt;{'OBJECTID': 0, 'scientificName': 1, 'lga': 2, 'classificationLocal': 3, 'localScientific': 4, 'GlobalID': 5}&lt;BR /&gt;{'OBJECTID': 0, 'scientificName': 1, 'commonName': 2, 'wons': 3, 'waStateDeclared': 4, 'qldStateDeclared': 5, 'nswStateDeclared': 6, 'vicStateDeclared': 7, 'saStateDeclared': 8, 'ntStateDeclared': 9, 'GlobalID': 10}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any ideas? I can't figure out what is going wrong here.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Nathan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2024 04:23:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/edit-features-succeeds-but-doesn-t-add-some/m-p/1551694#M10792</guid>
      <dc:creator>nate0102</dc:creator>
      <dc:date>2024-10-24T04:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: edit_features Succeeds but doesn't add some attributes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/edit-features-succeeds-but-doesn-t-add-some/m-p/1553254#M10807</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/554224"&gt;@nate0102&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Could you &lt;A href="https://community.esri.com/t5/community-help-documents/how-to-insert-code-in-your-post/ta-p/914552" target="_self"&gt;post your code&lt;/A&gt;?&amp;nbsp; Below is an example I was able to get to work:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS

# Variables
username = 'jskinner_rats'
password = '********'
itemID = '5b86f23053fc40aebb7197ce735a4dfc'

# Connect to portal
print("Connecting to AGOL")
gis = GIS("https://www.arcgis.com", username, password)

# Reference Table
print("Referencing table")
fLayer = gis.content.get(itemID)
editTable = fLayer.tables[0]

addFeatures = [
    {
        'attributes': {
            'lga': 'test',
            'scientificName': 'Acacia longifolia',
            'classificationLocal': 'Very High Priority',
            'localScientific': 'Acacia longifolia'
        }
    },
    {
        'attributes': {
            'lga': 'test',
            'scientificName': 'Amaryllis belladonna',
            'classificationLocal': 'High Priority',
            'localScientific': 'Amaryllis belladonna'
        }
    }
]

# Add record
print("Adding records")
for record in addFeatures:
    editTable.edit_features(adds=[record])
    print(result)
print('Finished')&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2024 13:43:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/edit-features-succeeds-but-doesn-t-add-some/m-p/1553254#M10807</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2024-10-29T13:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: edit_features Succeeds but doesn't add some attributes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/edit-features-succeeds-but-doesn-t-add-some/m-p/1553644#M10815</link>
      <description>&lt;P&gt;Can you post the field overview? Maybe your fields aren't configured as String or they have domains on them?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 06:52:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/edit-features-succeeds-but-doesn-t-add-some/m-p/1553644#M10815</guid>
      <dc:creator>BijanTaheri</dc:creator>
      <dc:date>2024-10-30T06:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: edit_features Succeeds but doesn't add some attributes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/edit-features-succeeds-but-doesn-t-add-some/m-p/1554994#M10842</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/517918"&gt;@BijanTaheri&lt;/a&gt;&amp;nbsp;thank you for your response. Please see below images.&lt;BR /&gt;&lt;BR /&gt;All strings, no domain.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nate0102_0-1730694456637.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/118729iFAE0D8FDAF6FFF96/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nate0102_0-1730694456637.png" alt="nate0102_0-1730694456637.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nate0102_1-1730694473350.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/118730iF44034EA5125B81C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nate0102_1-1730694473350.png" alt="nate0102_1-1730694473350.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nate0102_2-1730694493674.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/118731i7AE61EBD54C808EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nate0102_2-1730694493674.png" alt="nate0102_2-1730694493674.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 04:32:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/edit-features-succeeds-but-doesn-t-add-some/m-p/1554994#M10842</guid>
      <dc:creator>nate0102</dc:creator>
      <dc:date>2024-11-04T04:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: edit_features Succeeds but doesn't add some attributes</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/edit-features-succeeds-but-doesn-t-add-some/m-p/1555250#M10847</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/10527"&gt;@JakeSkinner&lt;/a&gt;, thank you for your response.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I first read in my data from SQL db as a Pandas Dataframe:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nate0102_0-1730754001261.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/118803i227A0EF4FE2ABE7D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nate0102_0-1730754001261.png" alt="nate0102_0-1730754001261.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then iterate through the rows to create the list of dictionaries (the edits).&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Prepare the data to be added to the lookup table by iterating through dataframe rows
lookup_lga_class_data = []
for index, row in df_arcade_lookup_lga_class.iterrows():
    lookup_lga_class_data.append({
        "attributes": {
            "lga": row["lga"],
            "scientificName": row["scientific_name"],
            "classificationLocal": row["classification_local"],
            "localScientific": row["local_scientific"]
            }
        })

lookup_pwd_data = []
for index, row in df_arcade_lookup_pwd.iterrows():
    lookup_pwd_data.append({
        "attributes": {
            "commonName": row["common_name"],
            "scientificName": row["scientific_name"],
            "wons": row["wons"],
            "waStateDeclared": row["wa_state_declared"],
            'qldStateDeclared': None,
            'nswStateDeclared': None,
            'vicStateDeclared': None
            }
        })

# test to make sure dictionary has populated correctly (it does).
lookup_lga_class_data[:2]
lookup_pwd_data[:2]

# delete the existing features
ft_lookup_lga_class.delete_features(where="1=1")

# add the edits
ft_lookup_pwd.edit_features(adds=lookup_pwd_data)
ft_lookup_lga_class.edit_features(adds=lookup_lga_class_data)&lt;/LI-CODE&gt;&lt;P&gt;The main difference I can see between our code is that I edit_features in one line by adding the whole list in, instead of a for loop.&lt;/P&gt;&lt;P&gt;Thanks again for your time.&lt;/P&gt;&lt;P&gt;Nathan&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 21:09:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/edit-features-succeeds-but-doesn-t-add-some/m-p/1555250#M10847</guid>
      <dc:creator>nate0102</dc:creator>
      <dc:date>2024-11-04T21:09:50Z</dc:date>
    </item>
  </channel>
</rss>

