I'm trying to use arcpy.da.SearchCursor to go through records in a feature class stored in a SQL SDE database. I do so through a feature layer (created in arcpy) called "unit_lyr". When I run the da.SearchCursor, the where clause is ignored and arcpy returns all records in the layer. When I run it using the old arcpy.SearchCursor, everything runs as expected.
Any idea why?
# Run it the old way, everything goes fine. unit_list =  rows = arcpy.SearchCursor('unit_lyr', 'UnitDate IS NOT NULL') for row in rows: if row.UnitName is not None: if len(row.UnitName) > 1: unit_list.append(row.UnitName) >>> len(unit_list) 192 # Use arcpy.da and all values are returned. unit_list =  with arcpy.da.SearchCursor('unit_lyr', 'UnitName', 'UnitDate IS NOT NULL') as rows: for row in rows: if row is not None: if len(row) > 1: unit_list.append(row) >>> len(unit_list) 1085