I am writing a script used for repairing data sources in an ArcGIS Pro project. All the data is located in SQL server enterprise databases. For various reasons I would like to determine the sde connection file used when the layer was added to project.
Looking at the documentation for the arcpy.mapping module I get a bit confused. Under the dataSource property for the layer class it is stated:
”TIP: Enterprise geodatabase layers in an ArcGIS Pro project do not retain the path to the database connection file (.sde) that was used to create the layer.”
This would indicate that I will not be able to retrieve the SDE file used when the data was added.
However, when I look at the documentation for the updateConnectionProperties method (again on the layer class) you need to provide the path of the original connection sde file as well as the new one. Furthermore, my initial tests shows that if you provide a dummy original file the update is not carried out. So, I guess that the path to original sde connection file must be stored in the layer info somehow. Is there any way to retrieve this?
In the setup I have, multiple sde files are in used, and if the script could identify these automatically it would save a lot of bookkeeping.