<?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 arcgis.features.table.append() not working with an AGOL Hosted Table as target, and CSV item or Published CSV Hosted Table as source in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-features-table-append-not-working-with-an/m-p/1534663#M10615</link>
    <description>&lt;P&gt;Using ArcGIS API for Python V 2.3.0 I cannot append a CSV item or hosted table published from that CSV item to records to another hosted table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The target table is a table in a feature layer with other tables and features. The CSV was prepared with the same schema as the target table and&amp;nbsp;&lt;SPAN&gt;uploaded from a local file to AGOL. I attempted to publish the csv so that I could append the hosted table created from publishing to another hosted table but my three attempts below failed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The final attempt using arcpy.management.Append() was a last ditch effort that actually worked by passing the service urls.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me figure out why the ArcGIS API for Python isn't working in this case?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a more complex set of functions that enables this process but simplified the code for this post below.&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;import arcgis
import arcpy

gis = GIS()
item_id = 'xyz'
acc_table = 1

dest_table = gis.content.get(item_id).tables[acc_table]

csv_item =  cm.add(item_properties = {
                'type': 'CSV',
                'title': title,
                'tags': '',
                'typeKeywords': "CSV"
            },
                data = local_csv_file)
analyzed = gis.content.analyze(item=csv_item)
publish_params = analyzed['publishParameters']
publish_params['name'] = title
publish_params['locationType'] = None
published_item = csv_item.publish(publish_params)

#1
dest_table.append(item_id = published_table.id, upload_format = 'featureCollection', source_table_name = published_table.tables[0].properties.name)
#2
dest_table.append(item_id = published_table.id, upload_format = 'featureService', source_table_name = published_table.tables[0].properties.name)
#3
dest_table.append(item_id = csv_item.id, upload_format = 'csv', source_table_name = csv_item.name, source_info = publish_params, update_geometry = False)

#Works
arcpy.management.Append(published_table.tables[0].url, dest_table.url, "NO_TEST")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Dec 2024 15:15:19 GMT</pubDate>
    <dc:creator>BenCapell_NWTF10</dc:creator>
    <dc:date>2024-12-18T15:15:19Z</dc:date>
    <item>
      <title>arcgis.features.table.append() not working with an AGOL Hosted Table as target, and CSV item or Published CSV Hosted Table as source</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-features-table-append-not-working-with-an/m-p/1534663#M10615</link>
      <description>&lt;P&gt;Using ArcGIS API for Python V 2.3.0 I cannot append a CSV item or hosted table published from that CSV item to records to another hosted table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The target table is a table in a feature layer with other tables and features. The CSV was prepared with the same schema as the target table and&amp;nbsp;&lt;SPAN&gt;uploaded from a local file to AGOL. I attempted to publish the csv so that I could append the hosted table created from publishing to another hosted table but my three attempts below failed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The final attempt using arcpy.management.Append() was a last ditch effort that actually worked by passing the service urls.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me figure out why the ArcGIS API for Python isn't working in this case?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a more complex set of functions that enables this process but simplified the code for this post below.&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;import arcgis
import arcpy

gis = GIS()
item_id = 'xyz'
acc_table = 1

dest_table = gis.content.get(item_id).tables[acc_table]

csv_item =  cm.add(item_properties = {
                'type': 'CSV',
                'title': title,
                'tags': '',
                'typeKeywords': "CSV"
            },
                data = local_csv_file)
analyzed = gis.content.analyze(item=csv_item)
publish_params = analyzed['publishParameters']
publish_params['name'] = title
publish_params['locationType'] = None
published_item = csv_item.publish(publish_params)

#1
dest_table.append(item_id = published_table.id, upload_format = 'featureCollection', source_table_name = published_table.tables[0].properties.name)
#2
dest_table.append(item_id = published_table.id, upload_format = 'featureService', source_table_name = published_table.tables[0].properties.name)
#3
dest_table.append(item_id = csv_item.id, upload_format = 'csv', source_table_name = csv_item.name, source_info = publish_params, update_geometry = False)

#Works
arcpy.management.Append(published_table.tables[0].url, dest_table.url, "NO_TEST")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 15:15:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-features-table-append-not-working-with-an/m-p/1534663#M10615</guid>
      <dc:creator>BenCapell_NWTF10</dc:creator>
      <dc:date>2024-12-18T15:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis.features.table.append() not working with an AGOL Hosted Table as target, and CSV item or Published CSV Hosted Table as source</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-features-table-append-not-working-with-an/m-p/1534847#M10616</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/775559"&gt;@BenCapell_NWTF10&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for your append, try the below...where your source_info is the object returned from the analyze() call, which in your case is the "analyzed" variable.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;analyzed = agol.content.analyze(
    item = csv_item.id,
    file_type = "csv",
    geocoding_service = None,
    location_type = None
)

dest_table.append(
    item_id = csv_item.id, # the CSV Item object id
    upload_format = 'csv',
    source_info = analyzed, # the object returned from the analyzed() call
    upsert = False
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No need to publish the CSV item to a Service in this workflow, the CSV item is sufficient.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know how it goes.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2024 08:43:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-features-table-append-not-working-with-an/m-p/1534847#M10616</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2024-09-04T08:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis.features.table.append() not working with an AGOL Hosted Table as target, and CSV item or Published CSV Hosted Table as source</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-features-table-append-not-working-with-an/m-p/1569784#M10975</link>
      <description>&lt;P&gt;Interesting approach. Thanks for the feedback. I have moved on from this workflow, but will consider this if I encounter it again.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 15:15:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-features-table-append-not-working-with-an/m-p/1569784#M10975</guid>
      <dc:creator>BenCapell_NWTF10</dc:creator>
      <dc:date>2024-12-18T15:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis.features.table.append() not working with an AGOL Hosted Table as target, and CSV item or Published CSV Hosted Table as source</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-features-table-append-not-working-with-an/m-p/1573494#M11013</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/417766"&gt;@Clubdebambos&lt;/a&gt;&amp;nbsp;, This doesn't work for me.&lt;/P&gt;&lt;P&gt;It works adding features from the csv to a hosted feature layer (modifying the .tables), but not when appending to a hosted table.&lt;/P&gt;&lt;P&gt;Any thoughts?&lt;/P&gt;&lt;P&gt;I also tried your data that you posted in another question. No luck.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 13:22:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-features-table-append-not-working-with-an/m-p/1573494#M11013</guid>
      <dc:creator>Iron_Mark</dc:creator>
      <dc:date>2025-01-08T13:22:47Z</dc:date>
    </item>
  </channel>
</rss>

