I have the following code which I'm trying to get to select a row by an input task number. It gives me an error, saying that I have an invalid sql clause. However, looking at the error message, I can't see what's invalid.
import arcpy, os
from arcpy import env
task = arcpy.GetParameterAsText(0)
expression = "Task =" + " '" + task +"'"
base_arpx = arcpy.mp.ArcGISProject(r"\\Projects_3\Fig_2_Pro.aprx")
rows = arcpy.da.SearchCursor(r"\\Projects_3\location.gdb\Task_Project_Name_1",
"Task; Name; shp_project_points; shp_buffer; workspace;", where_clause=expression)
Here is the error:
File "<string>", line 8, in <module>
RuntimeError: An invalid SQL statement was used. [SELECT OBJECTID,Task; Name; shp_project_points; shp_buffer; workspace; FROM Task_Project_Name_1 WHERE Task = '590']