<?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: Replace data source of SDE layers in map documents (mxd)  with Python’s replaceDataSource method in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/replace-data-source-of-sde-layers-in-map-documents/m-p/638576#M49801</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you looked through the examples in the documentation?&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/updatingandfixingdatasources.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/updatingandfixingdatasources.htm"&gt;Updating and fixing data sources with arcpy.mapping—Help | ArcGIS for Desktop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also consider &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/layer-class.htm"&gt;findAndReplaceWorkspacePath()&lt;/A&gt;. In your code, what is &lt;SPAN style="font-family: 'courier new', courier;"&gt;wrkspcInfra and newStation&lt;/SPAN&gt;?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, there is a &lt;A _jive_internal="true" href="https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet"&gt;syntax highlighting feature for posting code blocks&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jul 2016 17:15:27 GMT</pubDate>
    <dc:creator>BlakeTerhune</dc:creator>
    <dc:date>2016-07-19T17:15:27Z</dc:date>
    <item>
      <title>Replace data source of SDE layers in map documents (mxd)  with Python’s replaceDataSource method</title>
      <link>https://community.esri.com/t5/python-questions/replace-data-source-of-sde-layers-in-map-documents/m-p/638575#M49800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need some help to replace the data source of old SDE layers&lt;BR /&gt;in the map documents. The code outlined below is not working properly resulting&lt;BR /&gt;result in a broken link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We recently reorganized our ArcSDE database resulting in all&lt;BR /&gt;previous feature classes reorganized under the feature dataset with a new name.&lt;BR /&gt;In the interim, the SDE has both old and new data.&amp;nbsp; That results in a lot of map documents, in&lt;BR /&gt;which the data sources of all the layers need to be replaced with new workspace&lt;BR /&gt;path. Eventually, we want to delete the old sde feature classes directly under&lt;BR /&gt;the ArcSDE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on our research, lyr.replaceDataSource seems a&lt;BR /&gt;plausible solution since it provides an option of replacing both work space&lt;BR /&gt;path and dataset name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I greatly appreciate any input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; line-height: normal;"&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: gray; font-size: 9pt; font-family: 'Courier New';"&gt;#loop through the folder to locate mxds and layers within it and replace data source&lt;BR /&gt; of SDE layer&lt;BR /&gt; &lt;BR /&gt; &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: navy; font-size: 9pt; font-family: 'Courier New';"&gt;for &lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;fileName &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: navy; font-size: 9pt; font-family: 'Courier New';"&gt;in &lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;os.listdir(path):&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fullPath = os.path.join(path,&lt;BR /&gt; fileName)&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: navy; font-size: 9pt; font-family: 'Courier New';"&gt;if &lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;os.path.isfile(fullPath):&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; basename, extension =&lt;BR /&gt; os.path.splitext(fullPath)&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: navy; font-size: 9pt; font-family: 'Courier New';"&gt;if &lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;extension == &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: green; font-size: 9pt; font-family: 'Courier New';"&gt;".mxd"&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;:&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd =&lt;BR /&gt; arcpy.mapping.MapDocument(fullPath)&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: navy; font-size: 9pt; font-family: 'Courier New';"&gt;print &lt;/EM&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: green; font-size: 9pt; font-family: 'Courier New';"&gt;"MXD: " &lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;+ fileName&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: gray; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #get the list of all the layers&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;brknList = arcpy.mapping.ListLayers(mxd)&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: gray; font-size: 9pt; font-family: 'Courier New';"&gt;# Remove temporary connection file if it already exists&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; background: #ffe4ff; font-size: 9pt; font-family: 'Courier New';"&gt;sdeFile&lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt; = &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: green; font-size: 9pt; font-family: 'Courier New';"&gt;r"C:\Project\Output\TempConnection.sde"&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: navy; font-size: 9pt; font-family: 'Courier New';"&gt;if &lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;os.path.exists(&lt;SPAN style="background: #e4e4ff;"&gt;sdeFile&lt;/SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: navy; font-size: 9pt; font-family: 'Courier New';"&gt;print &lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; background: #e4e4ff; font-size: 9pt; font-family: 'Courier New';"&gt;sdeFile&lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; os.remove(&lt;SPAN style="background: #e4e4ff;"&gt;sdeFile&lt;/SPAN&gt;)&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: gray; font-size: 9pt; font-family: 'Courier New';"&gt;#replace data source of individual SDE layer&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: navy; font-size: 9pt; font-family: 'Courier New';"&gt;for &lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;brknItem &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: navy; font-size: 9pt; font-family: 'Courier New';"&gt;in &lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;brknList:&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: navy; font-size: 9pt; font-family: 'Courier New';"&gt;if &lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;brknItem.datasetName == &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: green; font-size: 9pt; font-family: 'Courier New';"&gt;'GISADMIN.ABC_Stations'&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;:&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; brknItem.replaceDataSource(wrkspcInfra, &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: green; font-size: 9pt; font-family: 'Courier New';"&gt;"SDE_WORKSPACE"&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;,newStation, &lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: navy; font-size: 9pt; font-family: 'Courier New';"&gt;False&lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;)&lt;BR /&gt; &lt;BR /&gt; &lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: gray; font-size: 9pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #elif brknItem.datasetName == 'GISADMIN.ABC_Layer':&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; line-height: normal;"&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: gray; font-size: 9pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; brknItem.replaceDataSource(wrkspcInfra2, &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: green; font-size: 9pt; font-family: 'Courier New';"&gt;"SDE_WORKSPACE"&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;,newABCLayer, &lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: navy; font-size: 9pt; font-family: 'Courier New';"&gt;False&lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; line-height: normal;"&gt;&lt;SPAN lang="EN" style="color: #3d3d3d; font-family: 'Arial','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; line-height: normal;"&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: gray; font-size: 9pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;outmxd = basename + &lt;/EM&gt;&lt;STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: green; font-size: 9pt; font-family: 'Courier New';"&gt;"_3"&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: black; font-size: 9pt; font-family: 'Courier New';"&gt;+ extension&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.saveACopy(outmxd)&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshTOC()&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; line-height: normal;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: 12pt;"&gt; --------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2016 15:22:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-data-source-of-sde-layers-in-map-documents/m-p/638575#M49800</guid>
      <dc:creator>Pyung_HoKim</dc:creator>
      <dc:date>2016-07-19T15:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Replace data source of SDE layers in map documents (mxd)  with Python’s replaceDataSource method</title>
      <link>https://community.esri.com/t5/python-questions/replace-data-source-of-sde-layers-in-map-documents/m-p/638576#M49801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you looked through the examples in the documentation?&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/updatingandfixingdatasources.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/updatingandfixingdatasources.htm"&gt;Updating and fixing data sources with arcpy.mapping—Help | ArcGIS for Desktop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also consider &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/layer-class.htm"&gt;findAndReplaceWorkspacePath()&lt;/A&gt;. In your code, what is &lt;SPAN style="font-family: 'courier new', courier;"&gt;wrkspcInfra and newStation&lt;/SPAN&gt;?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, there is a &lt;A _jive_internal="true" href="https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet"&gt;syntax highlighting feature for posting code blocks&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2016 17:15:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-data-source-of-sde-layers-in-map-documents/m-p/638576#M49801</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-07-19T17:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Replace data source of SDE layers in map documents (mxd)  with Python’s replaceDataSource method</title>
      <link>https://community.esri.com/t5/python-questions/replace-data-source-of-sde-layers-in-map-documents/m-p/638577#M49802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your time Blake!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for the first comment, I have looked at it and that is how I got an idea of using replaceDataSource method to change the data source.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the second, the path() method seems not allowing to specify a new name even though it can change the path of workspace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding the third, those are two variables (wrkspcInfra, newStation) for SDE workspace (i.e., feature dataset) and feature classes respectively. To illustrate, I set the variables as follow:&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: gray; font-size: 9pt; font-family: 'Courier New';"&gt;#Set up a variable for&lt;BR /&gt;new workspace; newly organized under sde feature dataset&lt;/EM&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: gray; font-size: 9pt; font-family: 'Courier New';"&gt; &lt;/EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: gray; font-size: 9pt; font-family: 'Courier New';"&gt;#wrkspcInfra = r'Database Connections\Connection to sde(sdeprod - user).sde\{}'.format(listDS[16]) #Infrastructure&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;EM&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"&gt;wrkspcInfra = &lt;/SPAN&gt;&lt;STRONG style="mso-fareast-font-family: 'Times New Roman'; color: green; font-size: 9pt; font-family: 'Courier New';"&gt;r'Database Connections\Connection to sde(sdeprod - user).sde\GISADMIN.INFRASTRUCTURE'&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: gray; font-size: 9pt; font-family: 'Courier New';"&gt;#Set up a variable for sde new dataset (feature class under the feature dataset above)&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: gray; font-size: 9pt; font-family: 'Courier New';"&gt; &lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM style="mso-fareast-font-family: 'Times New Roman'; color: gray; font-size: 9pt; font-family: 'Courier New';"&gt;#newStation = 'GISADMIN.INF_LIRR_GUI_STA_STATIONS_PT'&lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;EM&gt;&lt;EM&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt; mso-fareast-font-family: 'Times New Roman';"&gt;newStation = &lt;/SPAN&gt;&lt;STRONG style="mso-fareast-font-family: 'Times New Roman'; color: green; font-size: 9pt; font-family: 'Courier New';"&gt;r'Database Connections\Connection to sde(sdeprod - user).sde\GISADMIN.INFRASTRUCTURE\GISADMIN.INF_LIRR_GUI_STA_STATIONS_PT'&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;EM&gt;&lt;EM&gt;&lt;STRONG style="mso-fareast-font-family: 'Times New Roman'; color: green; font-size: 9pt; font-family: 'Courier New';"&gt;------------------------------------------------------------------------------------&lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;EM&gt;&lt;EM&gt;&lt;STRONG style=": ; mso-fareast-font-family: 'Times New Roman'; color: #808080; font-size: 9pt; font-family: 'Courier New'; font-style: italic;"&gt; &lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;As a matter of fact, I am trying different variations to set up parameters for the replaceDataSource methods as shown above. However, I haven't have that much of luck to make it running. As a reference, please see an example of feature dataset and feature class under SDE database below:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Infrastructure_dataset_feature_class_v1.JPG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/212524_Infrastructure_dataset_feature_class_v1.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="station_feature_class.JPG" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/212537_station_feature_class.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lastly, the syntax highlighter looks very useful. I will look into this for future usage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background: white;"&gt;&lt;EM&gt;&lt;EM&gt;&lt;STRONG style=": ; mso-fareast-font-family: 'Times New Roman'; color: #808080; font-size: 9pt; font-family: 'Courier New'; font-style: italic;"&gt; &lt;/STRONG&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2016 18:32:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-data-source-of-sde-layers-in-map-documents/m-p/638577#M49802</guid>
      <dc:creator>Pyung_HoKim</dc:creator>
      <dc:date>2016-07-20T18:32:18Z</dc:date>
    </item>
  </channel>
</rss>

