AnsweredAssumed Answered

Faster method than CalculateField_management?

Question asked by jplay on Jun 17, 2014
Latest reply on Jun 18, 2014 by jplay
I have a script that joins one table to another, then calculates one column to another. Everything works as it should, but it takes 4 hours to do so if it is scripted while it only takes a few seconds if I do it manually. The script actually does a lot more in that it loops through 4 tables and joins them each to 3 different tables. This is a process that needs to occur fairly regularly, so this is not something I really want to be doing manually every time I need to update these columns.

FieldNameList = ["CATTLE", "DAIRY", "POULTRY", "SWINE"] Iteration = 0 Iteration2 = 0 if TABLETYPE == "Animal Operations":     for JoinFile in UPDATELIST_join:         if Iteration > 2:             Iteration = 0             Iteration2 = Iteration2 + 1         layer = CENSUSLayerLIST[Iteration]         ANOPSFIELD = FieldNameList[Iteration2]         arcpy.AddJoin_management(layer, "GEOID10_1", JoinFile, "GEOID10_1", "KEEP_COMMON")         arcpy.CalculateField_management(layer, ANOPSFIELD, "!NumCount!", "PYTHON_9.3")         arcpy.RemoveJoin_management(layer)         Iteration = Iteration + 1 else:     for layer in CENSUSLayerLIST:         JoinFile = UPDATELIST_join[Iteration]         arcpy.AddJoin_management(layer, "GEOID10_1", JoinFile, "GEOID10_1", "KEEP_COMMON")         arcpy.CalculateField_management(layer, CENSUSFIELDTRANS, "!NumCount!", "PYTHON_9.3")         arcpy.RemoveJoin_management(layer)         Iteration = Iteration + 1

After my first attempt ran for 4 hours, I thought I might give da.SearchCursor / da.UpdateCursor a go. But after it ran for 6 hours I gave up.

Is there a better way to skin this cat?