I'm working with a table that has in excess of 800K records and my method of using nested cursors is not practical. I've been reading and it looks like I should switch to dictionaries, but after much research, I'm not sure how to replicate the functionality of the code below using dictionaries.
import arcpy sdeFiberSplice = r'C:\Users\broadhurstn\Documents\ArcGIS\Default.gdb\FIBERSPLICE' asBuiltFIBERSPLICE = r'C:\Users\broadhurstn\Documents\ArcGIS\Default.gdb\ASBUILTFIBERSPLICE' sdeFiberSpliceFields = ["asegmentidfkey", "zsegmentidfkey", "afiberid", "zfiberid", "bv_asbuilt_gdb_uploaded"] asBuiltFiberSpliceFields = ["ASEGMENTIDFKEY", "BSEGMENTIDFKEY", "AFIBERNUMBER", "BFIBERNUMBER"] with arcpy.da.SearchCursor(asBuiltFIBERSPLICE, asBuiltFiberSpliceFields) as cursor: for row in cursor: asegkey = row[0] zsegkey = row[1] asibid = row[2] zfibid = row[3] with arcpy.da.UpdateCursor(sdeFiberSplice, sdeFiberSpliceFields) as cursor: for row in cursor: if asegkey == row[0] and zsegkey == row[1] and asibid == row[2] and zfibid == row[3]: print asegkey row[4] = "Y" cursor.updateRow(row) print "Done."
Basic Logic of Code:
If combination of "ASEGMENTIDFKEY" and "BSEGMENTIDFKEY" and "AFIBERNUMBER" and "BFIBERNUMBER" in table "asBuiltFIBERSPLICE"
== combination of "asegmentidfkey" and "zsegmentidfkey" and "afiberid" and "zfiberid" in table "FIBERSPLICE"
than populate "bv_asbuilt_gdb_uploaded" with string "Y".
Visual Representation of Logic:
Can someone point me in the right direction with pseudocode?