AnsweredAssumed Answered

Attribute column not found

Question asked by paramatt on Jun 6, 2012
Latest reply on Jun 6, 2012 by mzcoyle
I am pretty sure there is something wrong with the way the SDE feature class fields are being referenced.  I have tried several combinations of single and double quotes with no change in result. Any assistance debuging this would be greatly appreciated.  

Result when executed in Python Shell:
>>> ================================ RESTART ================================ >>>  Script starting... Checking source data.   Traceback (most recent call last):   File "//server19/GIS/Projects/CAD Updates/Master Streets Update/Debugging.py", line 44, in <module>     DRows = arcpy.UpdateCursor(DestFC, (DestMFld + ' = ' + str(dID)))   File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\__init__.py", line 841, in UpdateCursor     return gp.updateCursor(*args)   File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py", line 362, in updateCursor     self._gp.UpdateCursor(*gp_fixargs(args))) RuntimeError: ERROR 999999: Error executing function. Attribute column not found [Microsoft SQL Server Native Client 10.0: Invalid column name 'None'.] [production.SDE.Streets_Master] >>> 


Source Script (executed in Python Shell)
import arcpy import datetime  print('Script starting...') #Default Values SourceFC = '//server19/gis/Projects/CAD Updates/Master Streets Update/StreetsUpdate_2012-05-22_1701.gdb/Deltas' SourceMFld = 'MC911ID' SourceExp = '1 = 1' DestFC = 'Database Connections\Production_Editing.sde\production.SDE.CAD_data\production.SDE.Streets_Master' DestMFld = 'ExternalStreetKey' DestExp = '1 = 1' DestCom = 'Notes'  #ArcGIS Script inputs ##SourceFC = arcpy.GetParameterAsText(0) ##SourceMFld = arcpy.GetParameterAsText(1) ##SourceExp = arcpy.GetParameterAsText(2) ##DestFC = arcpy.GetParameterAsText(3) ##DestMFld = arcpy.GetParameterAsText(4) ##DestExp = arcpy.GetParameterAsText(5) ##DestCom = arcpy.GetParameterAsText(6)   Source = SourceFC Destination = DestFC  #Set up variables sShape = arcpy.Describe(SourceFC).shapeFieldName dShape = arcpy.Describe(DestFC).shapeFieldName SRows = arcpy.SearchCursor(SourceFC) dcount = 0 bcount = 0 SourceLoopFlag = 0 DestinationLoopFlag = 0 MatchFlag = 0  #Loop through features, copy geometry as appropriate for SRow in SRows:     if SourceLoopFlag == 0:         SourceLoopFlag = 1         print("Checking source data. ")     dID = SRow.getValue(SourceMFld)     DRow, DRows = None, None     DRows = arcpy.UpdateCursor(DestFC, (DestMFld + ' = ' + str(dID)))     for DRow in DRows:         if DestinationLoopFlag == 0:             DestinationLoopFlag = 1             print("Checking destination data. ")         bID = DRow.getValue(DestMFld)             if bID == dID:             if MatchFlag == 0:                  MatchFlag = 1                  print("Match found. ")             updated = 'Updated ' + str(datetime.datetime.now())             DRow.setValue(DestCom, updated )             DRow.setValue(dShape, SRow.getValue(sShape))             DRows.updateRow(DRow)             bcount = bcount +1             break     del DRow     del DRows     dcount = dcount +1 del SRow del SRows print('Source rows processed: ' + str(dcount)) print('Destination rows updated: ' + str(bcount)) arcpy.AddMessage('Source rows processed: ' + str(dcount)) arcpy.AddMessage('Destination rows updated: ' + str(bcount)) print SourceLoopFlag print DestinationLoopFlag print MatchFlag  #Send messages to the results window. if SourceLoopFlag == 0:     arcpy.AddWarning('No source rows were checked.') if DestinationLoopFlag == 0:     arcpy.AddWarning('No destination rows were checked.') if MatchFlag == 0:     arcpy.AddWarning('No destination rows were updated.') print('Script Complete')        

Outcomes