rogerloweth

Layer definitionQuery memory leak

Discussion created by rogerloweth on Apr 24, 2013
Latest reply on Apr 24, 2013 by rogerloweth
Morning everyone,

The following code is being used on a very large dataset - millions of records.

The definition query seems to be the culprit.

Anybody have any ideas how to stop it please?

Also, I'm using a definition query because it is about a hundred times faster than using sql with the da.UpdateCursor

try:
        field1 = '"I"'
        field2 = '"J"'
        sql = str(field1) +  "=" + str(i_bin) + " AND " +  str(field2) + "=" + str(j_bin)
        layer.definitionQuery = sql
        with  arcpy.da.UpdateCursor(layer, ["EXTENSION_ID", "EXTENSION_VALUE"]) as cursor:
            for row in cursor:
                row[0] = 4
                row[1] += 1
                cursor.updateRow(row)
    except:
        showGpMessage(logFile)

Outcomes