I am attempting to join 2 tables together, and the tools in arcmap, such as add field can't do what I want so I tried using python and arcpy. My approach is to use 2 nested loops and find the values in the 2nd table and update the first one. This is the code that I am using:
with arcpy.da.UpdateCursor(table1, ufield) as ucursor:
for urow in ucursor:
print(urow[0])
with arcpy.da.SearchCursor(table2, sfield, """"VALUE" = """ + str(urow[0])) as scursor:
for srow in scursor:
print(srow)
urow[1] = srow[1]
urow[2] = srow[2]
urow[3] = srow[3]
urow[4] = srow[4]
urow[5] = srow[5]
urow[6] = srow[6]
urow[7] = srow[7]
urow[8] = srow[8]
urow[9] = srow[9]
urow[10] = srow[10]
urow[11] = srow[11]
urow[12] = srow[12]
urow[13] = srow[13]
urow[14] = srow[14]
urow[15] = srow[15]
urow[16] = srow[16]
urow[17] = srow[17]
urow[18] = srow[18]
urow[19] = srow[19]
urow[20] = srow[20]
ucursor.updateRow(urow)
n+=1
print(urow)
The problem is that it is extremely slow, so I would like to speed it up by stopping the search cursor loop after it finds the result. The values are all unique so after it returns a result, there is no need for the loop to keep on going. That was my thought on speeding it up, but of course I am open to other suggestions, or approaches that could help me achieve my goal.