Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

arcpy.da.UpdateCursor on joined tables?

$
0
0
Do data access update cursors work on joined tables? This thread indicates that Search Cursors do, but I keep getting a "cannot update join table" error. I have confirmed that I am trying to update the original table, not the joined table. Here's the pertinent code:

Code:

arcpy.MakeFeatureLayer_management(FC, "FC_lyr")
FC_lyr = "FC_lyr"
arcpy.AddJoin_management(FC_lyr, "joinField", joinedFCTable, "joinField")

fields =("{}.DataField".format(FC_lyr), "{}.OtherDataFiedl".format(joinedFCTable))
where = '"{}.OBJECTID" IS NOT NULL'.format(joinedFCTable)

with arcpy.da.UpdateCursor(FC_lyr, fields, where) as rows:
    for row in rows:
        row[0] = row[0] + row[1]

As an aside, I am trying to use the da.UpdateCursor because it is far faster than using field the calculator (code that I already have working) & I am trying to optimize speed.

Thanks,
-Erik

Viewing all articles
Browse latest Browse all 2485

Trending Articles