<?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 A better way to run large Append/Merge jobs in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/a-better-way-to-run-large-append-merge-jobs/m-p/346209#M27158</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Being frustrated at the unnecessarily long processing times of the Merge and/or Append tools for large datasets, I wrote some simple Python code (using the data access module in v10.1) to emulate the same functionality. Took my 2 hour Merge processing time to 11 minutes &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I hope someone else can benefit from this code. Right now it is designed to just run on polygon FCs with the same schema, although it could be enhanced to do field mapping as well (not on my time though). It relies on a simple search and insert cursor using the arcpy.da module. BTW, ESRI surely gets some huge props from me for the new cursor model...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy
fcList = [a list of FCs that you want to merge together]
outputFC = r"C:\temp\test.gdb\merge"
for fc in fcList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if fcList.index(fc) == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(fc, outputFC)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insertRows = arcpy.da.InsertCursor(outputFC, ["SHAPE@","*"])
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; searchRows = arcpy.da.SearchCursor(fc, ["SHAPE@","*"])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for searchRow in searchRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insertRows.insertRow(searchRow)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del searchRow, searchRows
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Appended " + str(fc) + "..."
del insertRows&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Sep 2012 15:49:23 GMT</pubDate>
    <dc:creator>ChrisSnyder</dc:creator>
    <dc:date>2012-09-07T15:49:23Z</dc:date>
    <item>
      <title>A better way to run large Append/Merge jobs</title>
      <link>https://community.esri.com/t5/python-questions/a-better-way-to-run-large-append-merge-jobs/m-p/346209#M27158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Being frustrated at the unnecessarily long processing times of the Merge and/or Append tools for large datasets, I wrote some simple Python code (using the data access module in v10.1) to emulate the same functionality. Took my 2 hour Merge processing time to 11 minutes &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I hope someone else can benefit from this code. Right now it is designed to just run on polygon FCs with the same schema, although it could be enhanced to do field mapping as well (not on my time though). It relies on a simple search and insert cursor using the arcpy.da module. BTW, ESRI surely gets some huge props from me for the new cursor model...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy
fcList = [a list of FCs that you want to merge together]
outputFC = r"C:\temp\test.gdb\merge"
for fc in fcList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if fcList.index(fc) == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(fc, outputFC)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insertRows = arcpy.da.InsertCursor(outputFC, ["SHAPE@","*"])
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; searchRows = arcpy.da.SearchCursor(fc, ["SHAPE@","*"])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for searchRow in searchRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insertRows.insertRow(searchRow)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del searchRow, searchRows
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Appended " + str(fc) + "..."
del insertRows&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2012 15:49:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/a-better-way-to-run-large-append-merge-jobs/m-p/346209#M27158</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2012-09-07T15:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: A better way to run large Append/Merge jobs</title>
      <link>https://community.esri.com/t5/python-questions/a-better-way-to-run-large-append-merge-jobs/m-p/346210#M27159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Nice cursor use code!&amp;nbsp; This was very helpful to me this morning while I was trying to write a script that creates a certain number of duplicate parcels within the same feature class&amp;nbsp; - the number of duplicate parcels created is controlled by a variable that indicates how many unique addresses are located within that parcel.&amp;nbsp; I used an InsertCursor with a SearchCursor to make this happen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Much thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Lee&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Oct 2013 14:28:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/a-better-way-to-run-large-append-merge-jobs/m-p/346210#M27159</guid>
      <dc:creator>LeeBrannon</dc:creator>
      <dc:date>2013-10-30T14:28:21Z</dc:date>
    </item>
  </channel>
</rss>

