For reasons that are too numerable my organization has yet to update our database and sde feature layers to Pro versions. As such we cannot use attribute rules yet. One layer that our editor uses needs to have two fields updated using other fields. Doing it by hand is cumbersome when dealing with 400 plus features. Our work around so far has been to use calculate field tool which works but when the updated values require some high level expressions it can be discouraging. I developed a python script to do this for me and it runs just great for me but my coworkers keep getting the error that only the owner of sde.default can make edits.
edit.startEditing(True, True)
RuntimeError: Operation only allowed by the owner of the version [sde.DEFAULT]
I have set it up to use the arcpy.management.ChangeVersion. However, the same error appears even after using this function. Why isn't the version my coworkers are choosing not being used? Secondly I have noticed that if I have a selection in the feature layer once I change the version of the feature layer that selection is no longer valid. shouldn't the selection still be honored? The parameters are all set up through drop down lists and layer lists, so I am pretty confidant that the correct paths and names are being used. I find it strange I can use this script with no errors but others can't, I am not the owner of the sde.default version either.
Code:
Solved! Go to Solution.
Finally got it figured out.
Apparently the Geodatabase connection was not pointing to the right version. I had been selecting it through ArcCatalog application but Pro does not seem to recognize that selection. Figured it out when I did the connection through the arcCatalog panel in Pro.
Doing this actually eliminates the need to use ChangeVersion().
ChangeVersion does not seem to work when I try to use it in a script because the geodatabase connection is already established when this script is run. I can accept this workaround and wonder how others use ChangeVersion in scripts. Is my intended use an inappropriate use of this function?
The "version" you are referring to here,
arcpy.management.ChangeVersion("parcel_lyr","TRANSACTIONAL",version)
can have different Access Permissions.
Private: Only the owner can view and edit.
Protected: All users can view, but only the owner can edit.
Public: All users can view and edit.
Perhaps a different Access Permission setting is required for your editing scenario.
All versions with the exception of the sde.DEFAULT are public
Hello @Nathan_Freitas . Could you try to modify your python script as per the below example and test once?
arcpy.AddMessage("Activate new version")
arcpy.ChangeVersion_management(parcel_lyr, 'TRANSACTIONAL', version, '')
Please feel free to share your thoughts.
Finally got it figured out.
Apparently the Geodatabase connection was not pointing to the right version. I had been selecting it through ArcCatalog application but Pro does not seem to recognize that selection. Figured it out when I did the connection through the arcCatalog panel in Pro.
Doing this actually eliminates the need to use ChangeVersion().
ChangeVersion does not seem to work when I try to use it in a script because the geodatabase connection is already established when this script is run. I can accept this workaround and wonder how others use ChangeVersion in scripts. Is my intended use an inappropriate use of this function?