<?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: Delete and Update operations in sequence to be followed in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/delete-and-update-operations-in-sequence-to-be/m-p/1638975#M9682</link>
    <description>&lt;P&gt;To supplement Vince's suggestion, for the visual&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/code-formatting-the-community-version/ba-p/1007633" target="_blank"&gt;Code formatting ... the Community Version - Esri Community&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Aug 2025 20:15:14 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2025-08-04T20:15:14Z</dc:date>
    <item>
      <title>Delete and Update operations in sequence to be followed</title>
      <link>https://community.esri.com/t5/geodatabase-questions/delete-and-update-operations-in-sequence-to-be/m-p/1638959#M9680</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been trying to select a number of features, delete some of them and update the rest. Like&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;edit = arcpy.da.Editor(workspace)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;edit.startEditing(with_undo=True, multiuser_mode=False)&lt;/DIV&gt;&lt;DIV&gt;arcpy.AddMessage("Edit Session Started")&lt;/DIV&gt;&lt;DIV&gt;logging.info(f"Edit Session Started in : {workspace}")&lt;/DIV&gt;&lt;DIV&gt;try:&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;for id in Ids:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if id != Ids[0]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SearchCuror():&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; UpdateCursor()&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; deleteRow()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;except arcpy.ExecuteError as e:&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;arcpy.AddMessage(f"Error: {e}")&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;for id in Ids:&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SearchCuror():&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; UpdateCursor()&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; updateRow()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;edit.stopOperation()&lt;/DIV&gt;&lt;DIV&gt;edit.stopEditing(save_changes=True)&lt;BR /&gt;&lt;BR /&gt;But it encounters an error: Need an edit session&lt;BR /&gt;&lt;BR /&gt;What am I doing wrong&lt;BR /&gt;&lt;BR /&gt;Any advice is much appreciated&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Aug 2025 20:01:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/delete-and-update-operations-in-sequence-to-be/m-p/1638959#M9680</guid>
      <dc:creator>Rohanrajan</dc:creator>
      <dc:date>2025-08-04T20:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: Delete and Update operations in sequence to be followed</title>
      <link>https://community.esri.com/t5/geodatabase-questions/delete-and-update-operations-in-sequence-to-be/m-p/1638965#M9681</link>
      <description>&lt;P&gt;Please edit the question to place the code in a code block (click on "..." then "&amp;lt;/&amp;gt;" in the second row of icons).&lt;BR /&gt;Reading Python code without indention is nearly impossible.&lt;/P&gt;&lt;P&gt;It's also nearly impossible to debug incomplete code (especially when there are TWO &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;SearchCursor&lt;/FONT&gt;&lt;/STRONG&gt; flavors [and&lt;STRONG&gt; &lt;FONT face="courier new,courier"&gt;arcpy.SearchCursor&lt;/FONT&gt;&lt;/STRONG&gt; is deprecated, and should not be used in code written since 2013]).&lt;/P&gt;&lt;P&gt;But you should know that nesting cursors is an antipattern, and the likely cause of your error.&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;</description>
      <pubDate>Mon, 04 Aug 2025 20:16:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/delete-and-update-operations-in-sequence-to-be/m-p/1638965#M9681</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2025-08-04T20:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Delete and Update operations in sequence to be followed</title>
      <link>https://community.esri.com/t5/geodatabase-questions/delete-and-update-operations-in-sequence-to-be/m-p/1638975#M9682</link>
      <description>&lt;P&gt;To supplement Vince's suggestion, for the visual&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/code-formatting-the-community-version/ba-p/1007633" target="_blank"&gt;Code formatting ... the Community Version - Esri Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Aug 2025 20:15:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/delete-and-update-operations-in-sequence-to-be/m-p/1638975#M9682</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2025-08-04T20:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Delete and Update operations in sequence to be followed</title>
      <link>https://community.esri.com/t5/geodatabase-questions/delete-and-update-operations-in-sequence-to-be/m-p/1638984#M9683</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/704032"&gt;@Rohanrajan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a longshot, but it appears you're not performing an edit.startOperation() before starting the edit session.&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Mon, 04 Aug 2025 20:37:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/delete-and-update-operations-in-sequence-to-be/m-p/1638984#M9683</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2025-08-04T20:37:49Z</dc:date>
    </item>
  </channel>
</rss>

