79334199

Date: 2025-01-06 20:05:38
Score: 1
Natty:
Report link

The recommended way to sort columns from Arcpy is this:

    import arcpy

fc = 'c:/data/base.gdb/well'
fields = ['WELL_ID', 'WELL_TYPE']

# Use ORDER BY sql clause to sort field values
for row in arcpy.da.SearchCursor(
        fc, fields, sql_clause=(None, 'ORDER BY WELL_ID, WELL_TYPE')):
    print(u'{0}, {1}'.format(row[0], row[1]))

See 5B: https://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-data-access/searchcursor-class.htm#P_GUID-3CB1DFF4-983D-445F-9CB2-0FF1CD4B4880

After reading: https://community.esri.com/t5/python-questions/sql-clause-in-arcpy-da-searchcursor-is-not/td-p/51603

I found this reference in the documentation of ArcGIS: https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/basics/the-in-memory-workspace.htm

Limitations Memory-based workspaces have the following limitations:

Memory-based workspaces do not support geodatabase elements such as feature datasets, relationship classes, attribute rules, contingent values, field groups, spatial or attribute indexes, representations, topologies, geometric networks, or network datasets.

Specifically Attribute indexes means you cant sort.

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: P.Harrison