AnsweredAssumed Answered

Whereclause in geoprocessing tool *select where item in list.

Question asked by wtgeographer on Dec 11, 2014
Latest reply on Dec 15, 2014 by wtgeographer

I am getting an incorrect SQL statement while trying to extractby attributes where item is in list.  Can somebody help me form the correct SQL statement?

Line 30 below...

 

import arcpy
import os
arcpy.env.overwriteOutput = 1


# Check out any necessary licenses
arcpy.CheckOutExtension("Spatial")


base = r'C:\Users\Noah\Desktop\LCP Example\Scratch.gdb'
name = "landuse_Clip"
fc= os.path.join(base,name)
field = "Value"


arcpy.env.workspace = base


# Use SearchCursor with list comprehension to return a
#  unique set of values in the specified field
#
for row in arcpy.da.SearchCursor(fc, "Value"):
    values = [row[0]]


query = "Value" in values


# Extract Features where Value is in values
attExtract = ExtractByAttributes(name,  query)
attExtract.save("Extract_landuseRaster")
landuseRasterWeighted = "Extract_landuseRaster"

Outcomes