I'm trying to make edits to a versioned SDE Feature Class.

I joined a table that contained a list of all the point IDs that need to be updated. I called these PT_ID1 and joined them with PT_ID in the FC. Then I want to edit rows where PT_ID1 is not NULL. However, I can't seem to make any updates and keep getting the error message: Cannot update join table.

I'm trying to do this using ArcPy.

#import modules
import arcpy

#set workspace
arcpy.env.workspace = r"mysdeconnection.sde"

#set variables
FC = "sde.points"
table = "table.csv"

#create layer
lyr = arcpy.MakeFeatureLayer_management(FC, "point_lyr")

#join table to layer
lyr_Join = arcpy.AddJoin_management(lyr, "PT_ID", table, "PT_ID1") 

#get field names
#field_names = [f.name for f in arcpy.ListFields(lyr_Join)]
#print (field_names)

#Start editing
edit = arcpy.da.Editor(arcpy.env.workspace)

#edit whitespace
Editcount = 0
with arcpy.da.SearchCursor(lyr_Join,["Table.csv.PT_ID1"]) as cursor:
    for row in cursor:
        if row[0]!= None:
            with arcpy.da.UpdateCursor(lyr_Join,['NAME']) as cursor:
                for row in cursor:
                    Editcount += 1
    print (Editcount + " edits made")

#Stop editing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.