I have the following code snippet:
arcpy.SelectLayerByAttribute_management("dissBuffs_lyr", "NEW_SELECTION", '[sumPoint_2] > 1')
Where dissBuffs_lyr is a layer which has been converted from a feature class stored within a File Geodatabase with a variety of attributes one of which is sumPoint_2. I've tried so many variations of '[sumPoint_2] > 1' that I'm running out of ideas does anyone have any idea what I might be doing wrong?
Darren Wiens Completely forgot about AddFieldDelimiters! Thanks for mentioning.
John,
As Darren pointed out, you can just set your SQL expression, and reference as a variable in the SelectLayerByAttribute_management.
sql_exp = """{0} > {1}""".format(arcpy.AddFieldDelimiters(dissBuffs, "sumPoint_2"), int(1)) arcpy.SelectLayerByAttribute_management("dissBuffs_lyr", "NEW_SELECTION", sql_exp)
This would ensure that no matter where you pulled the data from, it would be formatted properly.