Taken from gis.stackexchange.com
I have a process which requires me to update the data of an application every week. The application's data is in an .SDE database while the updated data is in a file geodatabase. The updated data could contain new features or have features removed. The dataset has a relationship class which is why I do not want to delete the feature class. How should this example be adjusted to completely overwrite or update all rows from my FGDB to my .SDE database?
import arcpy
fields = "HOUSENO; DIR; STREET; DPAFEEDER; LSDATE; REMARKS; ACCOUNT_NO, SYMBOLROTATION"
fgdbRows = arcpy.SearchCursor(r'Q:\GWP_LifeSupport.gdb\LifeSupport', '''DPAFEEDER IS NOT NULL''', "", fields, "")
for aRow in fgdbRows:
print (aRow.HOUSENO, aRow.DIR, aRow.STREET, aRow.UNIT, aRow.DPAFEEDER, aRow.LSDATE, aRow.REMARKS, aRow.ACCOUNT_NO, aRow.SYMBOLROTATION)
sdeLs = arcpy.UpdateCursor(r'Database Connections\gisDev01.sde\SDEDEV.SDE.LifeSupport')
for row in sdeLs:
sdeLs.updateRow(aRow)
Given that your primary/authoritative data is in an enterprise geodatabase, you might be better off using geodatabase replication (See Understanding distributed data). Unless I misunderstand your situation, this is one of the use cases geodatabase replication was designed around. Esri has already done the hard work, why not leverage it.