Changing SDE connection file's version

152
0
12-07-2023 09:39 AM
YinghongLi1
Occasional Contributor

Hello,

ArcGIS Pro 2.95.  Oracle/SDE database and versioned.

The question is two parts. Thanks in advance.

1.  In SDE versioned editing,  do users have to save the username/password in the connection file before running the Python editing code?

1.1 At the same time,  do users have to switch the version to the editing version (not in the default version) using the Geodatabase Connection property?

2.  If the above is true,  is there a way to change the connection file's version using Python/ArcPy. The layer in the map project is already switched to the editing version, so I can get the editing version from the connection property of the editing layer. Uses change versions frequently. I think ArcObject can do this.

3.  code segments (indent does not work here):

workspace_sde=r"C:\Users\LiY\AppData\Roaming\ESRI\ArcGISPro\Favorites\SDEConnection.sde"

#i want to change the version of the workspace_sde

edit = arcpy.da.Editor(workspace_sde)
edit.startEditing(False, True)
edit.startOperation()

save_edit=False
icur = arcpy.da.InsertCursor(ic_layer, ic_flds)
for row in new_features:
icur.insertRow(row)
save_edit=True
del icur

edit.stopOperation()
edit.stopEditing(save_edit)

 

 

0 Kudos
0 Replies