BrokenLegMike

Update Cursor and Joined Tables

Discussion created by BrokenLegMike on Feb 28, 2012
Latest reply on Sep 19, 2017 by drhall001
Is it possible to access joined tables using arcpy.UpdateCursor? I have no problems access a joined table with arcpy.SearchCursor, but when I attempt it with Update, it errors out.

It errors on the arcpy.UpdateCursor(soil) I think because the update cursor doesn't like feature layers, but I change it to the feature class SOIL, the 2 str(row.getValue... syntaxes won't read the field names....I'm stumped.

import arcpy
from arcpy import env

env.workspace = r"Z:\Test.gdb"

arcpy.SpatialJoin_analysis("SOIL", "TERRAIN", "SPATIAL")

soil = "\"soil\""

arcpy.MakeFeatureLayer_management("SO_SOIL_P", soil)

arcpy.AddJoin_management(soil, "SITE_ID", "SPATIAL", "SITE_ID")

rows = arcpy.UpdateCursor(soil)

for row in rows:
        print str(row.getValue("SOIL.SITE_ID"))
        print str(row.getValue("SPATIAL.TSSD"))

Outcomes