Hello,
I am trying to update connection properties for all layers in a Pro project map that are connected to our admin database to a read-only version of that database. When I run the following script, it runs but the database connections do not get updated.
import arcpy
aprx = arcpy.mp.ArcGISProject("CURRENT")
for m in aprx.listMaps("Mobile_Map"):
for lyr in m.listLayers():
if not(lyr.isGroupLayer or lyr.isBasemapLayer):
try:
lyr.updateConnectionProperties(current_connection_info="A:\DBConnection\admin.sde", new_connection_info="A:\DBConnection\dr.sde")
except:
print("Not an sde database or the database connection does not need to be updated.")