AnsweredAssumed Answered

change version updateConnectionProperties

Question asked by agray1 on May 19, 2016

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'}}

Outcomes