Select to view content in your preferred language

Update layers to a new Enterprise Connection when original data source is unreachable

991
4
Jump to solution
02-22-2023 11:00 AM
Labels (1)
Spencer
Emerging Contributor

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?

1 Solution

Accepted Solutions
Spencer
Emerging Contributor

Solution was to use ArcCatalog to resource all old MXDs to new data source then import into ArcPro.

View solution in original post

0 Kudos
4 Replies
DavidPike
MVP Frequent Contributor

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.

Spencer
Emerging Contributor

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?

0 Kudos
DavidPike
MVP Frequent Contributor

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.

0 Kudos
Spencer
Emerging Contributor

Solution was to use ArcCatalog to resource all old MXDs to new data source then import into ArcPro.

0 Kudos