Unable to use arcpy to reset data source in a layer for SDE feature dataset/feature class

03-09-2017 07:42 PM
New Contributor II

I have a layer in ArcMap. I am trying to reset its data source using arcpy. Here is its old data source, which is a feature class GEOMATICS.Photo_pt within a feature dataset GEOMATICS.Multimedia.

lyr.dataSource = “C:\Users\aguiaa\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog\sdeh1p_GGDM_aguiaa_DC.sde\GEOMATICS.Multimedia\GEOMATICS.Photo_pt”


I want to change to lyr.dataSource  to be “W:\shared_resources\Applications\Esri\Desktop10.3_Pet_Houston\ArcCatalog\phousde_SSO.sde\GGDM.Multimedia\GGDM.Photo_pt”.


To achieve this, I make this function call:


lyr.replaceDataSource(“W:\shared_resources\Applications\Esri\Desktop10.3_Pet_Houston\ArcCatalog\phousde_SSO.sde”, 'SDE_WORKSPACE', “GGDM.Photo_pt”, False), but it gives:


lyr.dataSource = “W:\shared_resources\Applications\Esri\Desktop10.3_Pet_Houston\ArcCatalog\phousde_SSO.sde\GEOMATICS.Multimedia\GEOMATICS.Photo_pt”


As someone told me  the feature dataset is part of the workspace, so I tried this:


lyr.replaceDataSource(“W:\shared_resources\Applications\Esri\Desktop10.3_Pet_Houston\ArcCatalog\phousde_SSO.sde\GGDM.Multimedia”, 'SDE_WORKSPACE', “GGDM.Photo_pt”, False), but it gives:


lyr.dataSource = “W:\shared_resources\Applications\Esri\Desktop10.3_Pet_Houston\ArcCatalog\phousde_SSO.sde\GGDM.Multimedia\GEOMATICS.Multimedia\GGDM.Photo_pt


How can I get rid of “GEOMATICS.Multimedia” in the last line?  My intention is to replace GEOMATICS with GGDM in the data source.

I am using Advanced ArcSDE 10.3.1 and ArcDesktop 10.3.1.



0 Kudos
0 Replies