SQL and output syntax for Extract by Attributes

Discussion created by aaridd18 on Apr 3, 2012
Latest reply on Apr 3, 2012 by dkwiens
Hi all,

I have a couple of questions related to the syntax for Extract by Attributes, related to the code block below (part of a larger script):

for raster in arcpy.ListRasters: 
    outpoint = workspace + raster + "af"
    sqlclause = "VALUE" = 6 OR "VALUE" = 8
    extract = arcpy.ExtractbyAttributes (raster, sqlclause)
    extract.save (outpoint)

My understanding is that extract.save is the only way to save the output of Extract by Attributes. Do I need to create a full file pathname for this, or does it automatically save in the current workspace? (i.e., can I drop "workspace" from outpoint or is it understood to save within the current workspace?). Sorry if this is an obvious question, but I can't seem to find any documentation on this syntax.

Also, I'm copying the syntax from the online example for the SQL query, but it looks totally incorrect; does it need to be enclosed in square brackets?