7

I have an update cursor running that updates a field based on a lookup table (Python dictionary). The cursor completes fine, but seems to pause and hold after each 1000 records - I have a test in it to write out the time each 100 records, see code. If you look at the results - you can see the first 1000 records don't seem to take any time, but then the 1100th result is delayed. I am running this on an Oracle DB.

x = 0
cur = arcpy.da.UpdateCursor(property_fc,["FACILITYID","GLOBALID"])
for row in cur:
    x = x + 1
    if (x % 100) == 0:
        print("At {}, {}".format(x,datetime.now() - vST))
    if row[1] in global_id_lut:
        row[0] = global_id_lut[row[1]]
        cur.updateRow(row)

enter image description here

1
  • 2
    Looks like normal AUTOCOMMIT interval behavior to me.
    – Vince
    Oct 17, 2019 at 21:16

1 Answer 1

9

By default the auto commit interval is set to 1000. You can change the interval using the following:

arcpy.env.autoCommit = 5000
1
  • 3
    Probably ought to caveat on the law of diminishing returns with respect to increasing commit intervals.
    – Vince
    Oct 17, 2019 at 22:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.