BUG

Cannot edit SDE data with Python update or insert cursors

Last Published: April 25, 2020

Description

Update and insert cursors fail when trying to edit SDE data using a Python script. For example, the script below should edit field values in an SDE feature class. This code runs without error, however, the attribute values are not changed.

Code:
from win32com.client import Dispatch
gp=Dispatch("esriGeoprocessing.GPDispatch.1")
gp.workspace="Database Connections/Ora9204Helium.sde"
try:
table = "SYSTEM.rn_test"
rows = gp.UpdateCursor(table, "SHAPE.LEN > 20")
row = rows.next()
while row:
row.ATTR = 200
rows.UpdateRow(row)
row = rows.next()
except:
del rows
del row

Cause

This is a known limit. This is only a problem with versioned SDE data. If the data is not versioned, then the above code works as expected.

Workaround

A possible workaround is to use disconnected editing. This allows a user to check out ArcSDE data to a personal geodatabase. Once the data is in a personal geodatabase, insert and update cursors will work correctly. After editing is complete, check the data into the ArcSDE database.

Note:
More information can be found on Disconnected Editing in the ArcGIS Desktop Help. Select Building a Geodatabase > Disconnected editing on the Contents tab.

    Article ID:000007454

    Software:
    • ArcMap 9 x

    Get help from ArcGIS experts

    Contact technical support

    Download the Esri Support App

    Go to download options

    Discover more on this topic