AnsweredAssumed Answered

arcpy.da.SearchCursor with sql_clause containing SQL "COUNT"

Question asked by behrm on Sep 5, 2017
Latest reply on Sep 8, 2017 by behrm

I am working with ArcGIS 10.4.1.

The following statement:

 

[row[0] for row in arcpy.da.SearchCursor(in_table=sde_isolinien_FC,

                                                                     field_names=['NAME', ],

                                                                     where_clause='NAME=\'{0}\''.format(name),

                                                                     sql_clause=('COUNT (NAME)', None))]

 

forces c:\Python27\ArcGISx6410.4\python.exe to crash. 

 

However, since I am only interested in if there are records or not, the following statement is a workaround:

 

[row[0] for row in arcpy.da.SearchCursor(in_table=sde_isolinien_FC,

                                                                  field_names=['NAME', ],

                                                                  where_clause='NAME=\'{0}\''.format(name),

                                                                  sql_clause=('MAX (NAME)', None))

 

Is this a error/missunderstanding on my side or a bug in arcpy?

 

Thank You Bernhard

Outcomes