change version updateConnectionProperties

1950
0
05-19-2016 11:35 AM
Highlighted
Regular Contributor II

Ok so I am doing something wrong here.  I am trying to change the version of a layer using the python command line.

I don't want to use change version from the versioning toolbar because that does all of the layer in all for the maps.

The supplied sde connection points to a different version as specified in the geodatabase properties.  I uses easy connect syntax.

apr = arcpy.mp.ArcGISProject('current')

map3 = apr.listMaps("Map3")[0]

ptLayer = map3.listLayers()[0]

ptLayer.connectionProperties

{'dataset': 'XXX.XXXPoint', 'workspace_factory': 'SDE', 'connection_info': {'password': '<*********>', 'server': 'XXX.XXX.XX.XX.XX', 'instance': 'sde:oracle$XXX.XXX.XX.XX.XX:XXXX/XXX.XXX.XX.XX.XX', 'authentication_mode': 'OSA', 'version': 'XXX.Atlantic Week 26'}}

ptLayer.updateConnectionProperties(ptLayer.connectionProperties, r'C:\xxx\ArcGIS\Project\Demo\xxx_Reg_Week26.sde')

ptLayer.connectionProperties

{'dataset': 'XXX.XXXPoint', 'workspace_factory': 'SDE', 'connection_info': {'password': '<*********>', 'server': 'XXX.XXX.XX.XX.XX', 'instance': 'sde:oracle$XXX.XXX.XX.XX.XX:XXXX/XXX.XXX.XX.XX.XX', 'authentication_mode': 'OSA', 'version': 'XXX.Atlantic Week 26'}}

Reply
0 Kudos
0 Replies