Hello, I am seeking a way to extract top 5 records from a sorted search cursor. According to ESRI, we can use top for sql clause but it is only supported by SQL server. I tried range function (please see below) but it did not work unfortunately.
Thank you in advance for any coding advice!
with arcpy.da.SearchCursor(data, fieldName, sql_clause=(None,'ORDER BY IDA DESC')) as cursor:
for i in range(5):
for row in cursor:
print("IDA value: ", row[1])