<?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: Objects in this class cannot be updated outside an edit session in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/re-objects-in-this-class-cannot-be-updated-outside/m-p/1031942#M7014</link>
    <description>&lt;P&gt;If it works for admin users and not regular users whether using ArcPy or the GUI, it is permissions related.&amp;nbsp; The question is whether there is a workflow issue or defect.&amp;nbsp; Without knowing a bit more about the overall workflow, e.g., versioning steps before you get to the functional code part above, I can't offer much on that front.&amp;nbsp; I would suggest you have your DBA look at the database logs because there may be errors showing up there that could point you in the right direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Mar 2021 15:25:32 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2021-03-02T15:25:32Z</dc:date>
    <item>
      <title>Re: Objects in this class cannot be updated outside an edit session</title>
      <link>https://community.esri.com/t5/geodatabase-questions/re-objects-in-this-class-cannot-be-updated-outside/m-p/1031826#M7011</link>
      <description>&lt;P&gt;&lt;FONT size="3"&gt;Hi All,&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="3"&gt;I have defined the workspace, started and stopped the edit session, but afterwards, I am getting the Runtime Error (Objects in this class cannot be updated outside an edit session). The layer "CGD. ROAD_LOCATIONS" is versioned.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;……….Script (part)…………….&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;arcpy.env.workspace = r"\\Pas215q4\User Connection\GS-0001.database.windows.net(1).sde"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;edit = arcpy.da.Editor(arcpy.env.workspace)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;if (edit.isEditing!='True'):&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.startEditing(True, True)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.startOperation()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp; field = ['SECTION_ID']&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp; found_values = defaultdict(set)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor("CGD.ROAD_LOCATIONS", field, "[OBJECTID] &amp;gt; 944861") as cursor:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for i, column in enumerate(field):&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; if row[i] in found_values[column]:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.deleteRow()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; break&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for column, value in zip(field, row):&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; found_values[column].add(value)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp; edit.stopOperation()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp; edit.stopEditing(True)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;................................&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;When running this it breaks in (“for row in cursor”), and I am getting the following error message,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;EM&gt;&lt;STRONG&gt;………..Error message…………&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp; File "P:\Create_Assets.py", line 152, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp; File " P:\Create_Assets.py", line 52, in main&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;RuntimeError: Objects in this class cannot be updated outside an edit session [CGD. ROAD_LOCATIONS]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;No issue with the indentation, maybe I have missed the proper indent here as I am typing it manually. No issue with the script while running from the admin account, but other user accounts is experiencing the run-time issue.&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Great to have your suggestions on how to solve this issue please.&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;BR /&gt;&lt;BR /&gt;Shahriar&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 09:20:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/re-objects-in-this-class-cannot-be-updated-outside/m-p/1031826#M7011</guid>
      <dc:creator>ShahriarRahman</dc:creator>
      <dc:date>2021-03-02T09:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Objects in this class cannot be updated outside an edit session</title>
      <link>https://community.esri.com/t5/geodatabase-questions/re-objects-in-this-class-cannot-be-updated-outside/m-p/1031919#M7012</link>
      <description>&lt;P&gt;The following,&lt;/P&gt;&lt;BLOCKQUOTE&gt;No issue with the script while running from the admin account, but other user accounts is experiencing the run-time issue.&lt;/BLOCKQUOTE&gt;&lt;P&gt;strongly indicates there is a permissions issue happening, whether by design or a defect.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If non-admin users try the workflow manually in the application, do they get the same error?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 14:44:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/re-objects-in-this-class-cannot-be-updated-outside/m-p/1031919#M7012</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-03-02T14:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Objects in this class cannot be updated outside an edit session</title>
      <link>https://community.esri.com/t5/geodatabase-questions/re-objects-in-this-class-cannot-be-updated-outside/m-p/1031929#M7013</link>
      <description>&lt;P&gt;Hi Joshua,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If non-admin users try the workflow manually in the application, do they get the same error? &lt;STRONG&gt;Yes&lt;/STRONG&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The users have full access to the .sde feature class ("CGD.ROAD_LOCATIONS") and versioning completed. So, I believe there is little chance of permission issue. Do you think there might be some other reasons?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Shahriar&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 15:03:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/re-objects-in-this-class-cannot-be-updated-outside/m-p/1031929#M7013</guid>
      <dc:creator>ShahriarRahman</dc:creator>
      <dc:date>2021-03-02T15:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Objects in this class cannot be updated outside an edit session</title>
      <link>https://community.esri.com/t5/geodatabase-questions/re-objects-in-this-class-cannot-be-updated-outside/m-p/1031942#M7014</link>
      <description>&lt;P&gt;If it works for admin users and not regular users whether using ArcPy or the GUI, it is permissions related.&amp;nbsp; The question is whether there is a workflow issue or defect.&amp;nbsp; Without knowing a bit more about the overall workflow, e.g., versioning steps before you get to the functional code part above, I can't offer much on that front.&amp;nbsp; I would suggest you have your DBA look at the database logs because there may be errors showing up there that could point you in the right direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 15:25:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/re-objects-in-this-class-cannot-be-updated-outside/m-p/1031942#M7014</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-03-02T15:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Objects in this class cannot be updated outside an edit session</title>
      <link>https://community.esri.com/t5/geodatabase-questions/re-objects-in-this-class-cannot-be-updated-outside/m-p/1154120#M7589</link>
      <description>&lt;P&gt;Hello Joshua,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hit this same error code: ERROR 160250: Objects in this class cannot be updated outside an edit session&lt;/P&gt;&lt;P&gt;As opposed to using &lt;SPAN&gt;arcpy.da.Editor&lt;/SPAN&gt;, I found&lt;/P&gt;&lt;P&gt;with arcpy.EnvManager(scratchWorkspace=r"workspace path",workspace=r"workspace path"):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;run functions&lt;/P&gt;&lt;P&gt;solved the errors, I tried this without defining the admin login as well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/environment-settings/scratch-workspace.htm" target="_blank"&gt;Scratch Workspace (Environment setting)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I can elaborate, but see if this works&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 00:40:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/re-objects-in-this-class-cannot-be-updated-outside/m-p/1154120#M7589</guid>
      <dc:creator>KatyFlaherty</dc:creator>
      <dc:date>2022-03-16T00:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Objects in this class cannot be updated outside an edit session</title>
      <link>https://community.esri.com/t5/geodatabase-questions/re-objects-in-this-class-cannot-be-updated-outside/m-p/1521837#M9235</link>
      <description>&lt;P&gt;I realize this is an old post but was wondering if solution recommended by Katy worked. I am having a similar issue when trying to append data from a file geodatabase to an sde; getting an&lt;STRONG&gt; ERROR 160250: Objects in this class cannot be updated outside an edit session.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;m_RemovedSigns = r"C:\...\SignStaging.gdb\RemovedSigns_Stage"

m_StreetSigns_sde = r"C:\...\COGAdmin@sdeCity.sde\sdeCity.COGADMIN.StreetSigns"

m_RemovedSigns_sde = r"C:\...\COGAdmin@sdeCity.sde\sdeCity.COGADMIN.AbandonedFeaturesGDOT\sdeCity.COGADMIN.RemovedSigns"

m_workspace = r"C:\...\COGAdmin@sdeCity.sde"
m_schemaType = "NO_TEST"

def append_features():
    global m_RemovedSigns
    global m_RemovedSigns_sde
    global m_workspace

    # Begin editing
    edit = arcpy.da.Editor(m_workspace)
    edit.startEditing(False, True)
    edit.startOperation()

    try:
        arcpy.Append_management(m_RemovedSigns, m_RemovedSigns_sde, 
        m_schemaType)
        print("Appended selected records to RemovedSigns.")
    except Exception as ex:
        print("ERROR appending features: " + str(ex))

    edit.stopOperation()
    edit.stopEditing(True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any insight would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 21:34:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/re-objects-in-this-class-cannot-be-updated-outside/m-p/1521837#M9235</guid>
      <dc:creator>AriLukas2</dc:creator>
      <dc:date>2024-08-14T21:34:46Z</dc:date>
    </item>
  </channel>
</rss>

