<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Access an .sde connection file using UNC path instead of the local &amp;quot;Database Connections&amp;quot; in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739258#M57177</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm adding this summary for anyone that might need to do a similar thing.&amp;nbsp; I'm using &lt;A href="https://community.esri.com/migrated-users/3100" target="_blank"&gt;Xander Bakker&lt;/A&gt; 'isuncpath' function to check whether it is a local (mapped) drive or a UNC path. Then based on the results, I'm building the sdePath variable as need to get the path that arcpy needs for input to the CopyFeatures command (and most likely others).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If within your target geodatabase you are trying to write to a feature dataset vs the root of the database, look at how I'm assigning the targetFC variable (commented out since I'm not providing the other variables in this sample)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sample below doesn't do anything but print out the sdePath and the paths for the FCs in the For loop.&amp;nbsp; To test with the different types of local vs UNC paths, switch (un-comment) the other masterGDB attribute assignment line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os
# function to see if the masterGDB path is UNC or "local"
def isuncpath(a_path):&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return os.path.splitunc(a_path)[0] != ''

def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; #set path to one of the below
&amp;nbsp;&amp;nbsp;&amp;nbsp; masterGDB = r'Database Connections\me@master.sde\myDatabase.DBO.Masters'
&amp;nbsp;&amp;nbsp;&amp;nbsp; #masterGDB = r'\\newserver\Staff\___gisStaffConnections\me@master.sde\myDatabase.DBO.DWCMasters'

&amp;nbsp;&amp;nbsp;&amp;nbsp; if isuncpath(masterGDB):&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lstSdeFDS = os.path.split(masterGDB)&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lstDbOwnerFDS = lstSdeFDS[1].split(".")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sdePath =&amp;nbsp; ('{0}\\{1}.{2}.'.format(masterGDB, lstDbOwnerFDS[0], lstDbOwnerFDS[1]))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('sdePath: {0}'.format(sdePath))
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sdePath = masterGDB + "\\"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('sdePath: {0}'.format(sdePath))

&amp;nbsp;&amp;nbsp;&amp;nbsp; #then for using in my comands&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fdsToCopy&amp;nbsp; in ['Fclass1', 'FClass2', 'FClass3']:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print('&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Copying Master database {0} to temporary Master_update FGDB: ... '.format(fdsToCopy) )
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sourceFC = sdePath + fdsToCopy
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('sourceFC path: {0}'.format(sourceFC))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # next two lines are commented out since I'm not showing the setting of 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp;&amp;nbsp;&amp;nbsp; the updateFGDN and MasterFDS variables...but showing so others can get the gist
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #targetFC = updateFGDB + '\\' + masterFDS + '\\' + fdsToCopy
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.CopyFeatures_management (sourceFC, targetFC)

# End main function

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 07:28:09 GMT</pubDate>
    <dc:creator>RebeccaStrauch__GISP</dc:creator>
    <dc:date>2021-12-12T07:28:09Z</dc:date>
    <item>
      <title>Access an .sde connection file using UNC path instead of the local "Database Connections"</title>
      <link>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739254#M57173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working in 10.2.2 (and 10.3.1...and testing in Pro).&amp;nbsp; I'm trying to use a standard set of "connection files" for .sde, .and ags, connection files so running the scripts&amp;nbsp; 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.&amp;nbsp; This is a program that is pretty specific to our needs, but is run often (currently only by me, but that will change).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Typically these connection files are stored in a path similar to&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #3a0699;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;C:\Users\&amp;lt;user&amp;gt;\AppData\Roaming\ESRI\Desktop10.x\ArcCatalog&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3a0699;"&gt;&lt;SPAN style="color: #303030;"&gt;I would like to store them in a shared network folder with the UNC pathname, e.g. &lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #3a0699; font-family: courier new,courier;"&gt;\\&amp;lt;server&amp;gt;\GISStaff\myConnection@database.sde&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030; font-size: 12pt;"&gt;&lt;STRONG&gt;The problem:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;It seems that if I use the connection file, the arcpy.CopyFeatures_management (and probably any other command) it wants:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #3a0699; font-family: courier new,courier;"&gt;Database Connections\&lt;SPAN style="color: #3a0699; font-family: courier new,courier;"&gt;myConnection@database.sde&lt;/SPAN&gt;\master.DBO.theMasters\thePolys&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;If I use the UNC connection file, the command wants (note "master.DBO" in bold near end):&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #3a0699; font-family: courier new,courier;"&gt;\\newserver\GISStaff\&lt;SPAN style="color: #3a0699; font-family: courier new,courier;"&gt;myConnection@database.sde&lt;/SPAN&gt;\master.DBO.theMasters\&lt;STRONG&gt;master.DBO.&lt;/STRONG&gt;thePolys&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;Question&lt;/STRONG&gt;&lt;/SPAN&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;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?&amp;nbsp; 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.&amp;nbsp; (I'll be able to handle that)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;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.&amp;nbsp; (??)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;I'm trying to keep it simple, but flexible, without having to hard code the path.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;This is arcpy/python specific, but cross posting since GDB/SDE related&amp;nbsp; &lt;A href="https://community.esri.com/group/1680" target="_blank"&gt;Geodatabase&lt;/A&gt;​ &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;Thanks for any suggestions!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt;&amp;nbsp; it may be that I will just do the test for the "database Connection' string like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if 'Database Connection' in masterGDB2:
&amp;nbsp; &amp;lt;leave as is&amp;gt;
else:
&amp;nbsp; &amp;lt;add the database.owner&amp;gt;&lt;/PRE&gt;&lt;P&gt;So in that case, can anyone tell me how to strip everything before and including&amp;nbsp;&amp;nbsp; ".sde\\' from before my database.owner?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rebecca Strauch

Revised, in case no easy test....then would just need  "strip" syntax help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:28:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739254#M57173</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2021-12-12T07:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: Access an .sde connection file using UNC path instead of the local "Database Connections"</title>
      <link>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739255#M57174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In Python there is not much support for UNC paths (as to check for them or to define credentials to connect to them). You could use something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; unc_path = r"\\newserver\GISStaff\myConnection@database.sde"
&amp;nbsp;&amp;nbsp;&amp;nbsp; normal_path = r"C:\Users\blahblah\AppData\Roaming\ESRI\Desktop10.x\ArcCatalog\myConnection@database.sde"
&amp;nbsp;&amp;nbsp;&amp;nbsp; db_path = r"Database Connections\myConnection@database.sde"

&amp;nbsp;&amp;nbsp;&amp;nbsp; lst = [unc_path, normal_path, db_path]
&amp;nbsp;&amp;nbsp;&amp;nbsp; for p in lst:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print isuncpath(p), p

def isuncpath(a_path):
&amp;nbsp;&amp;nbsp;&amp;nbsp; import os
&amp;nbsp;&amp;nbsp;&amp;nbsp; return os.path.splitunc(a_path)[0] != ''

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... which will return this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;True \\newserver\GISStaff\myConnection@database.sde
False C:\Users\blahblah\AppData\Roaming\ESRI\Desktop10.x\ArcCatalog\myConnection@database.sde
False Database Connections\myConnection@database.sde&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:28:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739255#M57174</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T07:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Access an .sde connection file using UNC path instead of the local "Database Connections"</title>
      <link>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739256#M57175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And to include the missing part:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os

def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; unc_path = r"\\newserver\GISStaff\myConnection@database.sde\master.DBO.theMasters\thePolys"
&amp;nbsp;&amp;nbsp;&amp;nbsp; normal_path = r"C:\Users\blahblah\AppData\Roaming\ESRI\Desktop10.x\ArcCatalog\myConnection@database.sde\master.DBO.theMasters\thePolys"
&amp;nbsp;&amp;nbsp;&amp;nbsp; db_path = r"Database Connections\myConnection@database.sde\master.DBO.theMasters\thePolys"

&amp;nbsp;&amp;nbsp;&amp;nbsp; lst = [unc_path, normal_path, db_path]
&amp;nbsp;&amp;nbsp;&amp;nbsp; for p in lst:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if isuncpath(p):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst = os.path.split(p)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print os.path.join(lst[0], 'master.DBO.{0}'.format(lst[1]))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print p

def isuncpath(a_path):
&amp;nbsp;&amp;nbsp;&amp;nbsp; return os.path.splitunc(a_path)[0] != ''

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/PRE&gt;&lt;P&gt;which will yield:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;\\newserver\GISStaff\myConnection@database.sde\master.DBO.theMasters\&lt;STRONG&gt;master.DBO.&lt;/STRONG&gt;thePolys
C:\Users\blahblah\AppData\Roaming\ESRI\Desktop10.x\ArcCatalog\myConnection@database.sde\master.DBO.theMasters\thePolys
Database Connections\myConnection@database.sde\master.DBO.theMasters\thePolys&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:28:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739256#M57175</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T07:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Access an .sde connection file using UNC path instead of the local "Database Connections"</title>
      <link>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739257#M57176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander,&lt;/P&gt;&lt;P&gt;Between the &lt;EM&gt;isuncpath&lt;/EM&gt; and the &lt;EM&gt; lst = os.path.split(p)&lt;/EM&gt;&amp;nbsp;&amp;nbsp; I'm getting really close.&amp;nbsp; But I can't hard code the&amp;nbsp; "master.DBO" since that will change.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my case, lst[1]&amp;nbsp;&amp;nbsp;&amp;nbsp; is actually&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'sde_wcgis_master.DBO.DWCMasters'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the correct syntax to end up with&amp;nbsp;&amp;nbsp; just the&amp;nbsp;&amp;nbsp; 'sde_wcgis_master.DBO.'&amp;nbsp;&amp;nbsp; portion (since the&amp;nbsp; lst[1] could change).&amp;nbsp;&amp;nbsp;&amp;nbsp; I'm assuming it is a flavor of strip, I just haven't found the right combo yet.&amp;nbsp; (still testing though)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&amp;nbsp; getting my last question figured out.&amp;nbsp; I was trying to use strip instead of split&lt;/P&gt;&lt;P&gt;zz = lst[1].split('.')&lt;/P&gt;&lt;P&gt;I can work with that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help Xander.&amp;nbsp; I think I'm ready to roll in the morning on this!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2015 03:25:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739257#M57176</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2015-07-30T03:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Access an .sde connection file using UNC path instead of the local "Database Connections"</title>
      <link>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739258#M57177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm adding this summary for anyone that might need to do a similar thing.&amp;nbsp; I'm using &lt;A href="https://community.esri.com/migrated-users/3100" target="_blank"&gt;Xander Bakker&lt;/A&gt; 'isuncpath' function to check whether it is a local (mapped) drive or a UNC path. Then based on the results, I'm building the sdePath variable as need to get the path that arcpy needs for input to the CopyFeatures command (and most likely others).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If within your target geodatabase you are trying to write to a feature dataset vs the root of the database, look at how I'm assigning the targetFC variable (commented out since I'm not providing the other variables in this sample)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sample below doesn't do anything but print out the sdePath and the paths for the FCs in the For loop.&amp;nbsp; To test with the different types of local vs UNC paths, switch (un-comment) the other masterGDB attribute assignment line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os
# function to see if the masterGDB path is UNC or "local"
def isuncpath(a_path):&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return os.path.splitunc(a_path)[0] != ''

def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; #set path to one of the below
&amp;nbsp;&amp;nbsp;&amp;nbsp; masterGDB = r'Database Connections\me@master.sde\myDatabase.DBO.Masters'
&amp;nbsp;&amp;nbsp;&amp;nbsp; #masterGDB = r'\\newserver\Staff\___gisStaffConnections\me@master.sde\myDatabase.DBO.DWCMasters'

&amp;nbsp;&amp;nbsp;&amp;nbsp; if isuncpath(masterGDB):&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lstSdeFDS = os.path.split(masterGDB)&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lstDbOwnerFDS = lstSdeFDS[1].split(".")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sdePath =&amp;nbsp; ('{0}\\{1}.{2}.'.format(masterGDB, lstDbOwnerFDS[0], lstDbOwnerFDS[1]))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('sdePath: {0}'.format(sdePath))
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sdePath = masterGDB + "\\"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('sdePath: {0}'.format(sdePath))

&amp;nbsp;&amp;nbsp;&amp;nbsp; #then for using in my comands&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fdsToCopy&amp;nbsp; in ['Fclass1', 'FClass2', 'FClass3']:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print('&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Copying Master database {0} to temporary Master_update FGDB: ... '.format(fdsToCopy) )
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sourceFC = sdePath + fdsToCopy
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('sourceFC path: {0}'.format(sourceFC))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # next two lines are commented out since I'm not showing the setting of 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp;&amp;nbsp;&amp;nbsp; the updateFGDN and MasterFDS variables...but showing so others can get the gist
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #targetFC = updateFGDB + '\\' + masterFDS + '\\' + fdsToCopy
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.CopyFeatures_management (sourceFC, targetFC)

# End main function

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:28:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739258#M57177</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2021-12-12T07:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Access an .sde connection file using UNC path instead of the local "Database Connections"</title>
      <link>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739259#M57178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To get back to your question to exclude the last part of a string separated by points, you could do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;s = 'sde_wcgis_master.DBO.DWCMasters'

# split the string on the point and exclude the last element and join it with pionts
print '.'.join(s.split('.')[:-1])

# then I noticed the rpartition that splits on the last occurrence (first from right), take the first part.
print s.rpartition('.')[0]

# to include to point at the end
print '{0}.'.format('.'.join(s.split('.')[:-1]))
print '{0}.'.format(s.rpartition('.')[0])

# or shorter, just add the point
print '.'.join(s.split('.')[:-1]) + '.'
print s.rpartition('.')[0] + '.'&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:28:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739259#M57178</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T07:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Access an .sde connection file using UNC path instead of the local "Database Connections"</title>
      <link>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739260#M57179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Xander.&amp;nbsp; Those are all slick. I may try to merge those into my script at some point (but working, so moved on to next script) but it is definitely good reference for next time.&amp;nbsp; I appreciate the additional options.&amp;nbsp; I'm still trying to get in the habit of cleaner looking code....still do a lot of brunt force with python (but getting better). &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2015 23:59:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-an-sde-connection-file-using-unc-path/m-p/739260#M57179</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2015-07-30T23:59:01Z</dc:date>
    </item>
  </channel>
</rss>

