I am trying to use arcpy to buffer a file geodatabase feature class and want to set the buffer_distance to the maximum value of a field in a separate dBase table.
My code is:
in_features = "projectArea"
out_feature_class = "bufferedProjectArea"
buffer_distance = (SELECT MAX("Distance") FROM "distanceTable")
line_side = "FULL"
line_end_type = "ROUND"
dissolve_option = "ALL"
arcpy.Buffer_analysis(in_features, out_feature_class, buffer_distance, line_side, line_end_type, dissolve_option)
My distanceTable is a dbase table (.dbf) looks like this:
OBJECTID Type Distance
1 Raccoons 2100
2 Squirrels 0
12 Cities 4200
I am trying to buffer by the maximum value in the distance field of my distanceTable. In this case it is cities, but I want to make the code robust so that when I change the values, the buffer distance is still pointing to the max value. I am receiving generic "syntax error" and am looking for assistance for the proper SQL code to replace for:
buffer_distance = (SELECT MAX("Distance") FROM "distanceTable")
buffer_distance = (SELECT MAX("Distance") FROM "distanceTable")is not valid syntax