<?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: Issue when trying to update row using Update cursor in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307497#M23922</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It helps to post more of the error message.&amp;nbsp; The code snippet you posted executes several geoprocessing tools, anyone which can generate a variety of errors.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Apr 2017 21:26:07 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2017-04-04T21:26:07Z</dc:date>
    <item>
      <title>Issue when trying to update row using Update cursor</title>
      <link>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307496#M23921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I am relatively new to Python and Arcpy and I am getting the below error message when I try to update values in a row in a temporary layer which I have created from an Oracle Spatial table.&amp;nbsp; I believe that it could be related to the fact that you cannot have auto-incremented columns in Oracle tables, but any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "\\xxxxxx.py", line 49, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)&lt;BR /&gt;RuntimeError: The table does not have an auto-incrementing column.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;import arcpy&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;#Set environment workspace&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;arcpy.env.workspace = r"C:\Users\..."&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;in_table = "TABLE1"&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;temp_layer = "TABLE1_area"&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;out_layer= "TABLE1_area.lyr"&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;temp_wksp= r"\\..."&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;count = 0&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;#Generate a temporary table&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;arcpy.MakeFeatureLayer_management(in_table,temp_layer,workspace=temp_wksp)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;#Add a new field to the temporary table&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;arcpy.AddField_management(temp_layer,"AREA_TEMP","DOUBLE")&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;arcpy.AddField_management(temp_layer,"UNIQUE_ID","LONG")&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;fields = ["SHAPE@AREA","AREA_TEMP","UNIQUE_ID"]&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;#Populate the SHAPE_AREA2 field in each row using a SearchCursor and print out the results.&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;with arcpy.da.UpdateCursor(temp_layer,fields) as cursor:&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[1]=row[0]&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[2]=count&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count += 1&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("SHAPE@AREA: {0} AREA_TEMP: {1} UNIQUE_ID: {2}".format(row[0],row[1],row[2]))&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;del cursor&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;arcpy.env.workspace = temp_wksp&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;&lt;EM&gt;arcpy.SaveToLayerFile_management(temp_layer, out_layer)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Apr 2017 16:33:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307496#M23921</guid>
      <dc:creator>NaomiAng</dc:creator>
      <dc:date>2017-04-04T16:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Issue when trying to update row using Update cursor</title>
      <link>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307497#M23922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It helps to post more of the error message.&amp;nbsp; The code snippet you posted executes several geoprocessing tools, anyone which can generate a variety of errors.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Apr 2017 21:26:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307497#M23922</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-04-04T21:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Issue when trying to update row using Update cursor</title>
      <link>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307498#M23923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;as well as your workspaces...many scripting errors are saving and/or working in sketchy workspaces&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Apr 2017 22:34:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307498#M23923</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-04-04T22:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: Issue when trying to update row using Update cursor</title>
      <link>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307499#M23924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok thanks, I have updated my question with the full error message if this helps...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Apr 2017 10:12:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307499#M23924</guid>
      <dc:creator>NaomiAng</dc:creator>
      <dc:date>2017-04-05T10:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Issue when trying to update row using Update cursor</title>
      <link>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307500#M23925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the nature of TABLE1? Does it have an ObjectID?&lt;/P&gt;&lt;P&gt;And, by creating a temporary feature layer and then saving this to a layer file is not going to work imho.&lt;/P&gt;&lt;P&gt;The data will only exist for the duration of the session.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Apr 2017 11:28:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307500#M23925</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2017-04-05T11:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Issue when trying to update row using Update cursor</title>
      <link>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307501#M23926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;make a real table from your source... then try to see if the script error goes away&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Apr 2017 12:48:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307501#M23926</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-04-05T12:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: Issue when trying to update row using Update cursor</title>
      <link>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307502#M23927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your problems start here:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;#Generate a temporary table&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;in_table&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;temp_layer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;workspace&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;temp_wksp&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/make-feature-layer.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Make Feature Layer&lt;/A&gt; doesn't create a temporary table, it creates "a feature layer."&amp;nbsp; Looking up &lt;A href="http://support.esri.com/sitecore/content/support/Home/other-resources/gis-dictionary/term/feature%20layer" rel="nofollow noopener noreferrer" target="_blank"&gt;feature layer&lt;/A&gt; in Esri's GIS Dictionary:&lt;SPAN class="" style="-webkit-font-smoothing: antialiased; color: #4d4d4d; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fefefe; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN class="" style="color: #595959; font-family: 'Avenir Next W01', 'Avenir Next W00', 'Avenir Next', Avenir, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15.9375px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;1[data analysis]&lt;/SPAN&gt;&lt;SPAN style="color: #595959; font-family: 'Avenir Next W01', 'Avenir Next W00', 'Avenir Next', Avenir, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15.9375px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; A layer that references a set of feature data. Feature data represents geographic entities as points, lines, and polygons.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;workspace&lt;/SPAN&gt; parameter for Make Feature Layer is about validating field names, not a location to create a temporary table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are several tools you can use to create a copy of a feature class into a scratch or in-memory workspace:&amp;nbsp; &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/copy.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Copy&lt;/A&gt;, &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/copy-features.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Copy Features&lt;/A&gt;, &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/conversion-toolbox/feature-class-to-feature-class.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Feature Class to Feature Class&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:43:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/issue-when-trying-to-update-row-using-update/m-p/307502#M23927</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T14:43:30Z</dc:date>
    </item>
  </channel>
</rss>

