Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Layer definitionQuery memory leak

$
0
0
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

Code:

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)


Viewing all articles
Browse latest Browse all 2485

Trending Articles