AnsweredAssumed Answered

How can I extract full sde path from .sde conneciton file for use in arcpy.CreateReplica_management ERROR 000582

Question asked by rastrauch Champion on Feb 16, 2017
Latest reply on Feb 16, 2017 by rastrauch

I am trying to automate arcpy.CreateReplica_management and eventually the sync/updates.  This will be a one-way replaca to a fgdb, and all the necessary prerequisites are in place. Using Desktop 10.3.1 (eventually 10.5) and current using MS SQL ArcSDE 10.2.1 (still on SQL 2008), but will eventually move/upgrade that to 10.5 too.

 

When I ran the wizard in the "distributed geodatabase" toolbox, it worked by just using the .sde conneciton file (I wanted to replicate all feature classes), but I didn't get anything in the Results tab to grab a snippet.  Using the .sde connection file only in the Create Replica—Help | ArcGIS for Desktop tool, I would get the "arcgisscripting.ExecuteError: ERROR 000582" .

 

With suggestions and comments in https://community.esri.com/thread/52766#comment-263419   I reran the tool, dragging the individual feature classes in, vs.just the .sde connection file, and it ran successfully.  Looking at the snippet, I can see that it is wanted a list of the feature classes with the full sde path (including "owner").  something similar to

in_data="'Database Connections\me@master.sde\master.DBO.myDataset\sde_master.DBO.fc1';'Database Connections\me@master.sde\master.DBO.myDataset\sde_master.DBO.fc2';'Database Connections\me@master.sde\master.DBO.myDataset\sde_master.DBO.fc3'"

 

The "'Database Connections\me@master.sde" portion and the fc1, fc2, fc3, etc. I provide with input or derived arguments and I could also easily provide the "myDataset" info.

 

Q: How can I extract the bolded part....or at least the   DBO (or SDE or other user) portion?  It seems like I have done this in the past, since the path changes depending on the SDE or ArcGIS version, but I cannot find my code.

 

Other option is I can test to see if it exists with DBO, if not, test SDE, etc and then build it up, but I was wondering if there is an easier, more reliable way.  I have looked thru many geonet and stackexchange links, and most explain how to buld the .sde file, not how to break it down (or extract the path from sde.

 

Thanks for any suggestions or code. 

 

tagging Geodatabase

Outcomes