update cursor not working on versioned sde data

1254
6
Jump to solution
04-24-2018 10:25 AM
forestknutsen1
MVP Regular Contributor

Cannot edit versioned SDE data with Python update or insert cursor functions 

import arcpy
fc = r"xxx"

with arcpy.da.Editor(r"xxx") as edit:
  with arcpy.da.UpdateCursor(fc, ["LINESEGMENTNAME", "TEMP"]) as cu:
    for row in cu:
      print "print row 0:" + str(row[0])
      row[1] = "test"
      cu.updateRow(row)
‍‍‍‍‍‍‍‍‍
console output summary
print row 0:3
SystemError: error return without exception set‍‍‍


‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

It is stopping on line 9. I see in the above post that locks are sometimes the problem. I have tried destroying all locks on the target feature class and still get the error.

Arc 10.1

SDE 10.1 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
forestknutsen1
MVP Regular Contributor

The sql I tested for updating the vw tables. Just in case it helps anyone else in the future. But it has some risk with it. For my first time it was helpful to read this: https://sspinnovations.com/blog/versioning-dummies-part-4-esri-multiversion-views/ 

and this:What is a versioned view?—Help | ArcGIS Desktop 

call sde.version_util.set_current_version ('ARCFM8.vtest');
call sde.version_user_ddl.edit_version ('ARCFM8.vtest', 1);
update arcfm8.t_conductormarker_vw set REFERENCEDRAWING = 'test'
where OBJECTID = 3;
commit;
call sde.version_user_ddl.edit_version ('ARCFM8.vtest', 2);‍‍‍‍‍‍‍‍‍‍

View solution in original post

6 Replies
JoshuaBixby
MVP Esteemed Contributor

Forest, I hate when no one replies, so I am replying.  That said, there isn't much I can offer since you are working with quite old software.  My organization moved off 10.1 when it entered mature support a couple years ago, so I don't even have access to 10.1 software any longer.

What I can offer, without knowing more about your database back-end, is that your code snippet above works fine for me using ArcGIS Desktop 10.5.1 against a 10.3.1 Oracle enterprise geodatabase.

Good luck.

forestknutsen1
MVP Regular Contributor

Joshua, thanks for taking the time to reply. At least I know now that my approach is sound in general. I am thinking about the below options:

  • trying a join and a field calculator with arcpy
  • using cx_oracle with sql and update the versioned view tables
  • using stand alone sql to update the versioned view tables

On a side note we are trying (desperately) to get 10.2 so we at least will be back into a esri supported version. But we have massive corruption in are sde versions states. Which is causing no end of pain...

0 Kudos
JoeBorgione
MVP Esteemed Contributor

Forest- take a look at Esri Support 10.6  and you'll see that 10.2 gets retired in a year; perhaps you should/could give more consideration to a more recent upgrade. It may save you some trouble in the long run.  Good luck!

That should just about do it....
forestknutsen1
MVP Regular Contributor

oh... I did not know it was ending so soon... part of the problem is we are dependent on ArcFM8... So, we are trying to get to ArcFM8 10.2.1d... 

0 Kudos
forestknutsen1
MVP Regular Contributor

Sadly the field calculator also failed... and the old style update cursor (before da) also failed... so all that remains is doing it by hand or using the vw tables... 

0 Kudos
forestknutsen1
MVP Regular Contributor

The sql I tested for updating the vw tables. Just in case it helps anyone else in the future. But it has some risk with it. For my first time it was helpful to read this: https://sspinnovations.com/blog/versioning-dummies-part-4-esri-multiversion-views/ 

and this:What is a versioned view?—Help | ArcGIS Desktop 

call sde.version_util.set_current_version ('ARCFM8.vtest');
call sde.version_user_ddl.edit_version ('ARCFM8.vtest', 1);
update arcfm8.t_conductormarker_vw set REFERENCEDRAWING = 'test'
where OBJECTID = 3;
commit;
call sde.version_user_ddl.edit_version ('ARCFM8.vtest', 2);‍‍‍‍‍‍‍‍‍‍