I have to change the data source of all the layers of an ArcGIS Pro project map because of data migration from one sde to another sde. Is there any ArcGIS pro functionality to replace the data source of all the layers using one tool similar to ArcCatalog set data source functionality for .mxd?
Solved! Go to Solution.
I found a solution. One of the ESRI Tech Support article it has the solution. I have tested it and it replaced my data sources. Because of my projects has only one data source for each, it worked for me. Still we need to have the multiple data source replace capability for the situation. ESRI ArcGIS Pro development team should put this a bit of higher priority because it actually is a very important tool. below my code-
import arcpy as py aprx = py.mp.ArcGISProject(r'project_location') find_dict = {'connection_info': {'instance': 'sde:sqlserver:server_instance', 'server': 'server_name'}} replace_dict = {'connection_info': {'instance': 'sde:sqlserver:server_instance', 'server': 'server_name', 'authentication_mode': 'OSA'}} try: aprx.updateConnectionProperties(find_dict, replace_dict) py.AddMessage("Data Source Updated") except NameError: py.AddMessage(' does not replaced SQL data Source!!!') aprx.save()
Hopefully this will help others.
That isn't in Pro yet. See this issue which we have tagged as an ArcMap equivalency issue.
This idea has been around for over 3 years now. Do you know if a solution to this issue is even on the ESRI Road Map for Pro as an equivalency item that the Pro development will be working on?
I found a solution. One of the ESRI Tech Support article it has the solution. I have tested it and it replaced my data sources. Because of my projects has only one data source for each, it worked for me. Still we need to have the multiple data source replace capability for the situation. ESRI ArcGIS Pro development team should put this a bit of higher priority because it actually is a very important tool. below my code-
import arcpy as py aprx = py.mp.ArcGISProject(r'project_location') find_dict = {'connection_info': {'instance': 'sde:sqlserver:server_instance', 'server': 'server_name'}} replace_dict = {'connection_info': {'instance': 'sde:sqlserver:server_instance', 'server': 'server_name', 'authentication_mode': 'OSA'}} try: aprx.updateConnectionProperties(find_dict, replace_dict) py.AddMessage("Data Source Updated") except NameError: py.AddMessage(' does not replaced SQL data Source!!!') aprx.save()
Hopefully this will help others.
Hi I tried to replicate this and I could not update my connection property with a different version. I followed the technical guide. Are you able to update versions?
Hi Sean Phayakapong,
My reading of the documentation Updating and fixing data sources—ArcGIS Pro | Documentation
tells me you should be able to update the version in the connection dictionary. But you would need to be sure the user accessing the Project (or the Server service account using the published .msd) has access to the version you are trying to use. It is possible that a new version is only accessible to the creator of the version.
Did you get this resolved?
More news - at Pro 2.6, a tool is provided to update simple parts of the data source path for all layers in a project.
But there is a bug https://my.esri.com/#/support/bugs/BUG-000134033 (maybe will be fixed at 2.7) that prevents this working for changes to enterprise geodatabase connections (using .sde files) unless the connections use the data owner or sde user - so not generally helpful when using OSA connections.
see this thread in the Ideas forum Need Ability to Replace Data Source for Multiple Layers for up to date info.
Hi DavidHoy,
Do you have any new information on this? I tried going to the thread you referenced, but it's saying it's a Hidden or Archived page now. I've been trying to build out a python script to handle my enterprise geodatabase connections, but between layers, tables and views, with or without joins, versioned or unversioned, I'm finding every time I feel like I'm getting close I come across another case I have to handle. I'd love to put the script to bed and do this all out of the box!
Thank you.
@DavidHoy Bug - 0001340033 says it's fixed at 2.8.0 but I'm using 2.8.3 and I am unable to change enterprise geodatabase connections from one version to another version changing from OSA authentication to database authentication. It works for the first feature class in the aprx and then fails out on the rest. So I have to go manually and set the data source on the rest.
The link is dead, Kory.