Our organization is migrating from Oracle to Postgres and simultaneously migrating to a cloud environment. I'm trying to programmatically update the layers data source in a .APRX. I see this can be done using Arcpy updateConnectionProperties but it only appears to work when the data source is accessible. The data source is not accessible while in the cloud environment. The Find & Replace option in ArcPro/Catalog will only re-source data down to the layer level which would result in stepping through each layer manually. Previously ArcCatalog had the ability to set the data source at the file level which is what I'm trying to accomplish here. Any ideas?
Solved! Go to Solution.
Solution was to use ArcCatalog to resource all old MXDs to new data source then import into ArcPro.
https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/updatingandfixingdatasources.htm
Not tried it myself unfortunately but maybe the validate argument will do it
updateConnectionProperties(r'old', r'new', validate=False)
By default, the updateConnectionProperties method only updates a data source if the new_connection_info is a valid data source. If the validate parameter is set to False, the data source is set to that location regardless of whether it exists. This can be useful for scenarios that require data sources to be updated ahead of the data being created. In these cases, the data appears broken in the associated maps.
There is a known bug when using "updateConnectionProperties" between enterprise environments. https://support.esri.com/en/technical-article/000021728
Based on that link, it looks like my only option is to create a dictionary. Is it possible to set the "find dictionary" to validate=False?
I would imagine it's just specified in the same way as before, but with a dictionary input.
lyr.updateConnectionProperties(find_dict, replace_dict, validate=False)
If that doesn't work - It's a bit optimistic but maybe you could also try a path to a dummy GDB initially, then do the operation again to the new enterprise GDB.
Solution was to use ArcCatalog to resource all old MXDs to new data source then import into ArcPro.