I am creating a python script that compares two different feature classes - a parent and a child - and updates the child with whatever changes that were made to the parent. For example, all of our "prime time" data is stored in our Publication SDE gdb. We have a separate gdb that "mirrors" the Publication gdb, except it is projected to Web Mercator. Whenever a feature is added, removed, or changed in Publication, the script will detect it and make the corresponding change in the Web Mercator gdb. All of the adds, deletes, and updates are determined by comparing GlobalIDs. This works fine with deletes and updates, but I am having issues with adds. My code will correctly determine which row to insert from the input feature class to the output feature class, but when it is inserted into the output it is given a new GlobalID that doesn't match the original feature's GlobalID. I understand that the InsertCursor is technically inserting a new row, thus the new GlobalID, but what I need is a way to copy an individual row. My question is: Is there any way to copy an individual feature (row) from one location to another while maintaining the parent's GlobalID? I have only found ways of copying entire feature classes or tables. I feel like there should be a sort of 'CopyCursor'.
def insertRow(outInsertCur, outDatasetPath, inDatasetPath, globalId):
in_search = arcpy.SearchCursor(inDatasetPath, "GlobalID = '%s'" % globalId)
insert_row = in_search.next()
outInsertCur.insertRow(insert_row)
print "Inserted %s into %s" % (insert_row.GlobalID, outDatasetPath)
del in_search
out_insert = arcpy.InsertCursor(out_dataset_path)
insertRow(out_insert, out_dataset_path, in_dataset_path, add_id)
What I am trying to create is similar to replication, but my organization does not want to go that route.