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

da cursor behaviour on layers with where clause

$
0
0
I can't seem to find any reference to this in help or forums, but it seems a da cursor cannot apply a where clause to a layer with a where clause already applied. Does anyone know if this is this working as intended behaviour or a bug?

Here is some test code where this occurred.

Code:

import arcpy

data = r'D:\GIS\DataBase\misc.gdb\CLI_N'
lyr = 'temp'
arcpy.MakeFeatureLayer_management(data, lyr, 'OBJECTID < 100')
print(arcpy.GetCount_management(lyr))
count = 0
cursor = arcpy.da.SearchCursor(lyr, 'OBJECTID', 'OBJECTID < 10')
for _ in cursor:
    count += 1
print(count)

This code returned
Code:

>>>
99
99


Viewing all articles
Browse latest Browse all 2485

Latest Images

Trending Articles



Latest Images