d = {} flds = ['pk1', 'origFld1', 'origFld2'] with arcpy.da.SearchCursor(myTbl, flds) as c: for r in c: d[r[0]] = (r[1], r[2]) flds = ['pk2', 'destFld1', 'destFld2'] with arcpy.da.UpdateCursor('myFC', flds) as cc: for rr in cc: if d.has_key(rr[0]): rr[1] = d[rr[0]][0] rr[2] = d[rr[0]][1] rr[3] = d[rr[0]][2] cc.updateRow(rr) else: pass
d = dict([(r[0],(r[1],r[2])) for r in arcpy.da.SearchCursor(myTbl, ['pk1','origFld1','origFld2'])]) with arcpy.da.UpdateCursor('myFC', ['pk2','destFld1','destFld2']) as cc: for rr in cc: if rr[0] in d: rr[1],rr[2],rr[3] = d[rr[0]][0],d[rr[0]][1],d[rr[0]][2] cc.updateRow(rr)
Advantages: speed, flexibility, awesomeness
Disadvantages: none
... How about in 6 lines?d = dict([(r[0],(r[1],r[2])) for r in arcpy.da.SearchCursor(myTbl, ['pk1','origFld1','origFld2'])]) with arcpy.da.UpdateCursor('myFC', ['pk2','destFld1','destFld2']) as cc: for rr in cc: if rr[0] in d: rr[1],rr[2],rr[3] = d[rr[0]][0],d[rr[0]][1],d[rr[0]][2] cc.updateRow(rr)
Advantages: speed, flexibility, awesomeness
Disadvantages: none
... How about in 6 lines?d = dict([(r[0],(r[1],r[2])) for r in arcpy.da.SearchCursor(myTbl, ['pk1','origFld1','origFld2'])]) with arcpy.da.UpdateCursor('myFC', ['pk2','destFld1','destFld2']) as cc: for rr in cc: if rr[0] in d: rr[1],rr[2],rr[3] = d[rr[0]][0],d[rr[0]][1],d[rr[0]][2] cc.updateRow(rr)