I am fairly new to python scripting. Most of the basics I have down however still learning.
I am trying to create a python script to update a shapefile with information from two separate CSV files. There is a common attribute that will link the CSV records to the Shapefile. I want to update the records of the shapefile with information from provided in the CSV files.
I found a script from a website that appears to do what I am looking for (link below), however when I run the script it it errors on line 11: for row2 in cursor2 and states: "Runtime Error; Invalid SQL Statement". I have tried several different attempts to negate the issue to no avail. If anyone could point out what is wrong with the script or if you have a more efficient way to create a script to accomplish my goal I am all ears.
import arcpy from arcpy import env env.workspace = "C:/Data" print 'Processing...' fc = "parcels.shp" cursor = arcpy.da.SearchCursor(fc, ["APN"]) for row in cursor: SQL_stat= "APN = "+ str(row) fc2 = "Numerical_CSV.csv" cursor2 = arcpy.da.SearchCursor(fc, ["ASSESSMENT"], SQL_stat) for row2 in cursor2: UpdatedValue = row2 cursor3 = arcpy.da.UpdateCursor(fc2, ["TAXYEAR"],SQL_stat) for row3 in cursor3: row3 = UpdatedValue cursor3.updateRow(row3) del row del cursor del row2 del cursor2 del row3 del cursor3 print "Done"