I have a python script that updates the data source of mxd’s from staging to production. Here is an example of the code:
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:ProjectMyMap.mxd")
for lyr in arcpy.mapping.ListLayers(mxd):
lyr.findAndReplaceWorkspacePath(r"C:ProjectStagingData.SDE", r"C:ProjectProdData.SDE", False)
mxd.Save()
The script will successfully migrate the data sources of each layer in an mxd. However, any joins or relates defined on the mxd layer will not have their data source updated.
ESRI reported this as a bug in ArcGIS version 10.0 (http://support.esri.com/en/knowledgebase/techarticles/detail/37931) and the bug was supposedly fixed with ArcGIS 10.0 Service Pack 1 (http://downloads2.esri.com/support/documentation/ao_/10.0_SP1_Announcement.pdf)
However, I am still experiencing this problem at ArcGIS 10.2.2 (python 2.7.5, Windows 7). I am testing an mxd that relates spatial tables to an aspatial table in an Oracle database (none of which are registered with SDE). Has anyone been able to successfully update ArcMap data sources including joins and relates using the above arcpy methods? Or is this still a bug?