Hello,
I keep receiving a 000358 error on my select by attribute function. I know it is the SQL in the selection query but I am so lost on what I should do to fix it.
Essentially, the purpose of the script is to utilize the the names of school districts in the "SCHOOL_DIS" attribute column in a shape file, and preform a buffer around each individual district to produce its own shape file, so one school district buffer per shape file.
with arcpy.da.SearchCursor (input_shape, ["SCHOOL_DIS"]) as cursor:
for row in cursor:
district_name = row[0]
selection_query = "SCHOOL_DIS = " + district_name
arcpy.management.SelectLayerByAttribute (input_shape, "NEW_SELECTION", selection_query, "")
outputfile = os.path.join(path, "{}_buf_5mile.shp".format(district_name))
arcpy.analysis.Buffer (input_shape, outputfile, "5 Miles", "","","","","")
Please add your code as formatted text, not as a screenshot.
Community Help Documents > How to insert code in your post
# Here is an example of code as formatted text
import arcpy
for i in range(10):
print("code as formatted text")
added
Specifying a query in Python—ArcGIS Pro | Documentation
text would have to be enclosed by a single quote I think
district_name = "a"
"SCHOOL_DIS = '{}'".format(district_name)
"SCHOOL_DIS = 'a'"
but you had better check fhe fieldname delimiter syntax for your input source
Specifying a query in Python—ArcGIS Pro | Documentation