Unable to change SDE connections with Layer.updateConnectionProperties

359
0
03-02-2018 05:40 AM
ShaneBuscher
Occasional Contributor

I have an ArcSDE layer added to a map in an aprx.  I want to change its connection to a different ArcSDE gdb using a *.sde connection file. The dataset name is identical in both enterprise GDBs. After running the snippet below the layer's data source remain the same. I realize I could alter the dictionary instead, but that is not ideal as the password is encrypted in the *.sde file. Any insights on how to get this working? Is it even supported? 

...
map = aprx.listMaps()[0]
lyr = map.listLayers()[0]
lyr.updateConnectionProperties(lyr.connectionProperties, r"C:\foo\enterprisegdb.sde")

...

Tags (3)
0 Kudos
0 Replies