I'm using the code below in order to attempt to clone a row in a feature class and add that same row to the same feature class after updating its metadata (Name, date_start, date_end, etc.)
The problem is that it is duplicating the rows several times, when expecting 2 rows i get 4, expecting 3, getting 8.
inFeatureClass = "C:\TS.gdb\IN_TSGIS"
arcpy.MakeFeatureLayer_management(inFeatureClass, temp_layer_name)
insert_feature_table(temp_layer_name, temp_layer_name, query_single_col('UID',UID), update_fields)
def query_single_col(col, value):
return '"'+str(col)+'" = ' + str(value)
def insert_feature_table(inputfeatureclass, insertfeatureclass, expr, fields):
with arcpy.da.InsertCursor(insertfeatureclass, ("*")) as i_cursor:
with arcpy.da.SearchCursor(inputfeatureclass, ("*"), where_clause=expr) as s_cursor:
for s_row in s_cursor:
i_cursor.insertRow(s_row)
break
Any ideas as to why that is?