Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Update Cursor not working

$
0
0
I have this update cursor. The code executes in LiClipse without an error at all but none of my rows update in SDE. Am I missing a step?

Thanks,
Jordan


Code:

# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# stupidtest.py
# Created on: 2014-02-06 11:56:15.00000
#  (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy
import arceditor

arg_sdeDEV_sde = "Database Connections\\arg@sdeDEV.sde"
ARG_ACCESS_OPENING = "Database Connections\\arg@sdeDEV.sde\\ARG.DistributionSystem\\ARG.ACCESS_OPENING"
ACCESS_OPENING_Layer = "ACCESS_OPENING_Layer"

# Process: Make Feature Layer
arcpy.env.workspace = "Database Connections\\arg@sdeDEV.sde"
arcpy.env.overwriteOutput = True
arcpy.MakeFeatureLayer_management(ARG_ACCESS_OPENING, ACCESS_OPENING_Layer, "", arg_sdeDEV_sde, "OBJECTID OBJECTID VISIBLE NONE;OPEN_TYPE OPEN_TYPE VISIBLE NONE;REC_INFO_NAME REC_INFO_NAME VISIBLE NONE")

# Process: Start Edit
edit = arcpy.da.Editor(arcpy.env.workspace)
edit.startEditing(False, True)
edit.startOperation()

# Process: Select and Update Data
cursor = arcpy.UpdateCursor(ARG_ACCESS_OPENING)
for row in cursor:
    if str(row.getValue("STRUCTURE_ID")) == 'None':
        row.STRUCTURE_ID = str(row.getValue("ENCLOSURE_ID"))
        cursor.updateRow(row)
       
del cursor, row
       
print 'done'


Viewing all articles
Browse latest Browse all 2485

Trending Articles