I'm using the following code in my ArcMap python window and it's throwing an error. I'm trying to sort by two fields, one ascending and the other descending. The error seems to be indicating a typo but the field names are correct. This is referencing a layer in the table of contents from a file geodatabase feature class.
>>> with arcpy.da.UpdateCursor ("Parcels_Intersecting_ServiceLocations", ["Parcel_Ranking"], None, None, False, (None, "ORDER BY PGA_Plus_LIQ DESC, Fault_Dist_Meters ASC")) as curs: ... q = 0 ... for row in curs: ... q += 1 ... row  = q ... curs.updateRow (row) ...
Runtime error Traceback (most recent call last): File "<string>", line 3, in <module> RuntimeError: An invalid SQL statement was used. [SELECT Parcel_Ranking, Shape_Area, Shape_Length FROM Parcels_Intersecting_ServiceLocations ORDER BY PGA_Plus_LIQ DESC, Fault_Dist_Meters ASC]
I did some sanity checks:
>>> arcpy.Exists ("Parcels_Intersecting_ServiceLocations") True >>> flds = [f.name for f in arcpy.ListFields ("Parcels_Intersecting_ServiceLocations")] >>> print [f for f in ["Parcel_Ranking", "PGA_Plus_LIQ", "Fault_Dist_Meters"] if not f in flds]  >>>
Am I missing something obvious here?