AnsweredAssumed Answered

arcpy - SearchCursor with where_clause = "SHAPE IS NOT NULL" returns RuntimeError on in_memory feature class

Question asked by DemersM on Jul 17, 2017
Latest reply on Jul 18, 2017 by DemersM

Why the arcpy.da.SearchCursor with where_clause="SHAPE IS NOT NULL" returns RuntimeError: An invalid SQL statement was used when the feature class is stored in_memory?

 

For instance this works:

 

source = "\\\\cnatrtd8\\geo\\ArcGIS Server\\Connections\\GEODEV011.sde\\GEO09_WEB_MERCATOR\\GEO09E04_MUNCP_GEN"

with arcpy.da.SearchCursor(query_layer, ["*"], where_clause="SHAPE IS NOT NULL") as cursor:
    for row in cursor:
        print row[0]

 

while this returns a RuntimeError: An invalid SQL statement was used

   

source = "\\\\disk1\\myDB.sde\\myDataSet\\myFeatureClass"
copy = arcpy.CopyFeatures_management(source, "in_memory\\copy")

with arcpy.da.SearchCursor(copy, ["*"], where_clause="SHAPE IS NOT NULL") as cursor:
    for row in cursor:
        print row[0]

 

Any idea what is going wrong? Is there a workaround?

 

Thank you!

Outcomes