I have a bunch of MXD and I need to change the SDE connection in them using Python. These MXD include sde feature layers, sde tables and query layers.
For sde feature layers and tables replaceWorkspaces work as expected but it does not for query layers.
I tried with findAndReplaceWorkspacePaths and it works for query layers but NOT for sde feature layers.
So I guess I should combine both methods to get all the layers' connections changed, but this means changing the data source twice for every MXD. Isn't there a single method to do this all at once? I need all the process to be as fast as possible.
I may be wrong but my guess is that changing the data source for each layer separately will be slower.
Also, the only way to detect if a layer is a query layer is to look for the string '%' in its datasetName as mentioned here. I haven't tested it though.