AnsweredAssumed Answered

arcpy.da.InsertCursor breaks after 1000 records

Question asked by HOKis on Dec 2, 2015
Latest reply on Dec 4, 2015 by GSCUser85

Hi, I have a Pythonscript which transforms input featureclass and tables into several output tables and one featureclass. The output tables are connected to the featureclass and to each other with relationship classes (everything in one single GDB). For avoiding nested loops, i initially put the input data into pythonic lists ("data" in the code). I use ArcGIS 10.3.1, Python 2.7.8, here's the code (nothing special):

 

def insertRows(workspace, fields, data):
    edit.startOperation()
    with arcpy.da.InsertCursor(workspace, fields) as cursor:
        for row in data:
            try:
                cursor.insertRow(row)
            except:
                err = ""
                for elm in row:
                    err = err + str(elm) + "|"
                arcpy.AddError("Error at row: " + err)
                arcpy.AddError(sys.exc_info()[0])
    edit.stopOperation()

 

Stacktrace:

Traceback (most recent call last):
  File "XX.py", line 600, in <module>
    insertRows(xGDB + os.sep + "BP_Plan", fields_BP_Plan, dict_BP_Plan)
  File "XX.py", line 255, in insertRows
    cursor.insertRow(row)
RuntimeError: Feld kann nicht bearbeitet werden. # Field is not editable

 

Filling the tables with more than 8000 rows is no problem, but the code breaks exactly on inserting record #1000 into output featureclass. The row data itself has no problem (when I switch inputdata's OID sort direction, it also breaks on record #1000). The list objects are also filled. Maybe there are some known limitations on editsessions when many relationship classes are involved.

 

I would appreciate any hints.

Outcomes