SDE feature class attributes updated with Python script not displaying

2138
10
Jump to solution
07-26-2018 12:37 PM
LeeBrannon1
Occasional Contributor

My Python script tool runs from the geoprocessing pane in ArcGIS Pro 2.2, and what it does is create a new point in an SDE feature class and populate  attributes.  You could say that it is working, but the problem is that the new attributes for the point do not display in the attribute table until I perform more editing (manual, not via the script) on that feature class.  The new attributes need to be seen immediately after the script ends.  

I use an edit session in arcpy (my SDE feature class is versioned) and within that I do an update cursor for the new attributes.  But somehow there seems to be a delay with edits being committed or the row getting updated or the edit session being saved.

0 Kudos
10 Replies
LeeBrannon1
Occasional Contributor

I got it working!  

The feature layer idea wasn't it at all...still using the feature layer, but what did work was actually very simple.  At the very end of my script, which is immediately after the StopEditing(True) statement, I added a Try/Except statement - where I added code to change the SDE database connection back to the Default version - since I was finished editing anyway.   Maybe it just needed some code at the end to help the edit session complete and the SDE database to refresh, and the specific code I gave it really didn't matter what that was.  I'm not sure.