Hello. I'm working on a script that (among other things) needs to parse out all the SDE-like text of a feature class name to leave just the individual fc name at the end of the fullname (i.e. Database Connections\Connection to blahblah.sde\SampleDB.SDE.Communications\SampleDB.SDE.Cameras needs to called Cameras).
I've been searching ArcGIS Resources and find ways to edit field names, but could use some help...
Thanks in advance!
I copy SDE feature classes into file GDB's using a script I generated with Model Builder and all the SDE nomenclature is automatically dropped. You could try generating a snip it using feature class to feature class in Model Builder and use it in your script. I don't generally script from scratch but I know this has worked for me.
You might try something like this:
wksp = # your SDE connection
arcpy.env.workspace = wksp
output = # your output geodatabase or folder
fc = # feature class to convert
base = os.path.basename(fc)
b = base.split(".") # splits on the periods
b1 = len(b)
b2= b[b1 - 1] # gets the last string which should be the name you want)