I'm working in 10.2.2 (and 10.3.1...and testing in Pro). I'm trying to use a standard set of "connection files" for .sde, .and ags, connection files so running the scripts will work on multiple machines. However, I'm trying to keep it generic enough in case someone else uses with a different (local) connection file type. This is a program that is pretty specific to our needs, but is run often (currently only by me, but that will change).
Typically these connection files are stored in a path similar to
C:\Users\<user>\AppData\Roaming\ESRI\Desktop10.x\ArcCatalog
I would like to store them in a shared network folder with the UNC pathname, e.g.
\\<server>\GISStaff\myConnection@database.sde
The problem:
It seems that if I use the connection file, the arcpy.CopyFeatures_management (and probably any other command) it wants:
Database Connections\myConnection@database.sde\master.DBO.theMasters\thePolys
If I use the UNC connection file, the command wants (note "master.DBO" in bold near end):
\\newserver\GISStaff\myConnection@database.sde\master.DBO.theMasters\master.DBO.thePolys
Question:
Other than checking for the string "Database Connections" in my variable, does anyone know a way to check whether the .sde file is in the local connection folder vs. a UNC path? If I can test for it reliably, I can strip the data I need and add it to the string before I add the featureclass name. (I'll be able to handle that)
Interesting (?) side note: in previous ArcGIS versions (maybe 9.x or 10.0), I always had to have the additional info in the path. Then in one of the updates to ArcGIS, that broken the script and I had take it back to just the featureclass name.....seems this is a combination or maybe a remnant of the old way. (??)
I'm trying to keep it simple, but flexible, without having to hard code the path.
This is arcpy/python specific, but cross posting since GDB/SDE related Geodatabase
Thanks for any suggestions!
EDIT: it may be that I will just do the test for the "database Connection' string like this:
if 'Database Connection' in masterGDB2:
<leave as is>
else:
<add the database.owner>
So in that case, can anyone tell me how to strip everything before and including ".sde\\' from before my database.owner?
Message was edited by: Rebecca Strauch
Revised, in case no easy test....then would just need "strip" syntax help.