AnsweredAssumed Answered

How to use Search/Update Cursor to update values of one feature class to another?

Question asked by geoffreywestgis on Aug 10, 2016
Latest reply on Aug 10, 2016 by bixb0012


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)

Outcomes