<?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: ArcPy Layer updateConnectionProperties not working as expected in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519994#M40745</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used the&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;aprx&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;updateConnectionProperties in ArcGIS PRO 2.6 runs very slow as it goes through all 
the layers that need to be change.  It takes about four minutes each layer and at some point
it does not give me error and just seats there spinning.  In ArcMap was a 100 times faster.
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;arcpy
&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;sys
CASE = sys.argv[&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;]
aprx = arcpy.mp.ArcGISProject(&lt;SPAN style="color: #6a8759;"&gt;"CURRENT"&lt;/SPAN&gt;)
aprx.updateConnectionProperties(&lt;SPAN style="color: #6a8759;"&gt;r"C:\GIS_WorkSpace\Geodatabase\CASES\Shapes"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;r"X:\PD_Notify\Labels-2020\\" &lt;/SPAN&gt;+ CASE)
&lt;SPAN style="color: #cc7832;"&gt;del &lt;/SPAN&gt;aprx&lt;/PRE&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 22:40:50 GMT</pubDate>
    <dc:creator>JorgeMorteo</dc:creator>
    <dc:date>2021-12-11T22:40:50Z</dc:date>
    <item>
      <title>ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519982#M40733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am attempting to use Arcpy Layer&amp;nbsp;updateConnectionProperties method to change the database connection for each layer in an ArcPro project from my SDEDEV environment to an SDEUAT environment. Note that both database are identical copies so they only vary in the database name/servername, instance name and PWD. In our organization this is a common task when we are publishing services in a DEV environment. Once&amp;nbsp;we are ready for Users to Test (UAT) our apps and underlying services/maps we publish to UAT. This workflow allows us the ability to continue developing new stuff without affecting the users that are testing the stuff that was developed in previous deployments. When we used ArcMap we had a python toolbox tool that would re-map the database connections for each layer in a map from DEV to UAT and Finally to PROD once we were ready for the final deployments. Our goal is to have a similar workflow, I would like to do&amp;nbsp;use some&amp;nbsp;ESRI ArcPy Pro Python code to update the connection information. I assumed that the "updateConnectionProperties" method should be able to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After researching and comparing other solutions and using ESRI documentation &lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/mapping/updatingandfixingdatasources.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;here &lt;/A&gt;I was able to come up with the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
aprx = arcpy.mp.ArcGISProject(r'C:\ProProjects\MyProj\TheProPoject.aprx')
for theMap in aprx.listMaps():
 print("%-24s %s" % ("Map Name:", theMap.name))
 for lyr in theMap.listLayers():
 if lyr.supports("CONNECTIONPROPERTIES"):
 print("%-24s %s" % ("layer Name:", lyr.name))
 lyr.updateConnectionProperties(lyr.connectionProperties,r'C:\ProProjects\MyProj\DatabaseConnections\ARCGISSERVER@SDEUAT2.sde', True, False)
aprx.save()
del aprx
print("done")&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This solutions kinda works but with some caveats:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The connection is not getting reset when using the SDE database connection that I currently have indicated. I know this connection works because I can use the same connection to manually reset a layer's datasource in ArcPro.&lt;/LI&gt;&lt;LI&gt;I force the connection to get set WITHOUT validation (the last False parameter). This results in "broken" layer connections. Though this is not the prefered method, at this point I can open the ProProject and then select the "red-exclamation" broken layer for one and point the layer to the new desired database connection. The good news is that this fixes all other broken connections provided that it found the "same" data layers in the new database connection.&lt;/LI&gt;&lt;LI&gt;This one is an interesting find: the only layers in my ArcPro Map Project that get reset to "broken" are the ones that inside a Group Layer. Any layers in a Map that are NOT in a Group Layer are ignored. The print inside the for each layer loop shows that I see the layer and this it indeed has a connectionproperty that I checking (lyr.supports("CONNECTIONPROPERTIES")) for before calling the&amp;nbsp;&lt;SPAN&gt;updateConnectionProperties. For all the layers that are not in a group, I still need to manually set the layer datasource in the ArcPro project because it does not break the connection or even change it. (this does not seem to me like expected behavior)&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Questions:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;Has anyone successfully used the&amp;nbsp;updateConnectionProperties&amp;nbsp;method to change from one database connection to another?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Am I using this class correctly? Layer.updateConnectionProperties&lt;SPAN&gt;&amp;nbsp;...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;I see that ArcPy also has an&amp;nbsp;updateConnectionProperties&amp;nbsp; for the entire APRX project. According to the ESRI documenation (above) I see the following "&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;You have control of updating data sources for individual layers or tables, or you can update all the layers or tables in a common workspace at once" And all the sample look similar to what I have.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #4c4c4c;"&gt;Thought, comments, suggestions are greatly appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #4c4c4c;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #4c4c4c;"&gt;Diana&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:33:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519982#M40733</guid>
      <dc:creator>DianaBenedict1</dc:creator>
      <dc:date>2021-12-12T16:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519983#M40734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Diana,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having similar issues with updating layers to a SDE connection, and share the same three questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For me, I'm trying to bring in a workflow from ArcMap where I used the Layer.replaceDataSource(workspace_path, workspace_type, dataset_name) method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ArcGIS Pro, I temporarily set the layer source to&amp;nbsp;a SDE feature class I wanted - through Layer Properties. I ran print(lyr.connectionProperties) to get a glimpse of what everything should be and copied it. Then reset the source to the .gdb fc, and attempted to run lyr.updateConnectionProperties(current connection info, new connection info). Still no luck...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Brett&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2019 16:08:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519983#M40734</guid>
      <dc:creator>BrettLessner_Nsight</dc:creator>
      <dc:date>2019-05-24T16:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519984#M40735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brett&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If did you try to put the layer in your map in a Group Layer? I found that I was at least able to "break" the connection with the validate = false property. At least when you do this, you can reset the connection for all the "broken" layer connections at once by simply hitting the red exclamation. However, as I stated above I was unable to get anything to work if the layers were not in a group.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Personally, I believe this is a bug. I am going to submit this bug via tech support and see if I can get some help there. Glad to know I am not the only one out there experiencing the same issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for responding, maybe we will get some interest from others as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will add more comments as I get more info.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Diana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2019 16:49:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519984#M40735</guid>
      <dc:creator>DianaBenedict1</dc:creator>
      <dc:date>2019-05-24T16:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519985#M40736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Diana,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No, I cut my losses for now, and went back to ArcMap for what I needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you're right about it being a bug - looks like others have similar issues:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/233152"&gt;Replacing datasource does not work through arcpy&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/228083"&gt;Updating connection info via python from SDE to File geodb - with a feature dataset&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/230916"&gt;Updating Data Source in ArcGIS PRO project with arcpy&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Brett&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2019 17:22:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519985#M40736</guid>
      <dc:creator>BrettLessner_Nsight</dc:creator>
      <dc:date>2019-05-24T17:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519986#M40737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just wondering if anyone else has figured this issue out or if &lt;STRONG&gt;ESRI staff&lt;/STRONG&gt; is aware of the potential bug with the Python API&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;updateConnectionProperties method.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Updating Database Connections in ArcPro is becoming exceedingly time consuming and I was hoping to get the python script to&amp;nbsp;&lt;SPAN&gt;updateConnectionProperties to work correctly. I am assuming that ESRI would prefer for us to continue to move forward and use ArcPro instead of taking a step backwards and revert to ArcMap simply because "updateConnectionProperties" is not working correctly.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;Diana&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2019 18:38:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519986#M40737</guid>
      <dc:creator>DianaBenedict1</dc:creator>
      <dc:date>2019-07-18T18:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519987#M40738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just spoke with ESRI Support and they indicated that this is a defect. Here is the bug # in case anyone else runs into this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;The Defect ID is:&amp;nbsp;BUG-000112574&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;&lt;SPAN style="font-size: 11pt;"&gt;From now, when using the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN style="font-size: 11pt;"&gt;updateConnectionProperties&amp;nbsp;method, I will set th&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.6667px;"&gt;Validate&lt;/SPAN&gt;&lt;SPAN style="font-size: 11pt;"&gt;&amp;nbsp;option to&amp;nbsp;"False". This will at least break the connection in my ArcPro project and then I can set it manually by selecting on one of the broken red exclamation connections.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-size: 11pt; "&gt;Cheers and good luck!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 16:17:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519987#M40738</guid>
      <dc:creator>DianaBenedict1</dc:creator>
      <dc:date>2019-07-26T16:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519988#M40739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Diana:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you saying that all the Pro-based python&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;updateConnectionProperties method will do is break existing SDE connections and then you would need to manually go into each aprx file and hit the red exclamation point to reconnect to SDE once again?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 16:51:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519988#M40739</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2019-07-26T16:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519989#M40740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No by default, the&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;Pro-based python&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;updateConnectionProperties method will not break the existing datasource connection. However, you can force it break the connection if you set the "Validate" property to False - as I have shown in the script in my original post. If Validate is set to False then it will break the connection and give you a red exclamation. However, I noted above in item #3 (in my original post) that this only occured in layers that were placed inside a group layer. I have given ESRI Tech Support all this information and I believe that they will be putting all this into the Defect ID listed above.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;I hope this helps.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Diana&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 22:59:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519989#M40740</guid>
      <dc:creator>DianaBenedict1</dc:creator>
      <dc:date>2019-07-26T22:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519990#M40741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;the script below for me works fine. I'm updating the dictionary keys coming out of connectionProperties and running updateConnectionProperties method.&lt;/P&gt;&lt;P&gt;I'm changing database user and password doing for all sql server sde layers in a chosen map. If you need to change something else just update the&amp;nbsp;relevant dictionary value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# Input parameters are  the chosen map within the current project, new user name and password&lt;/SPAN&gt;
mapName &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetParameterAsText&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
newUser &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetParameterAsText&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
newUserPass &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetParameter&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#===================================&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#The default project is the current one....&lt;/SPAN&gt;
aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'CURRENT'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
currentMap &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mapName&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Loop layers excluding group layers and basemap&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; lyr &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; currentMap&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;isGroupLayer &lt;SPAN class="operator token"&gt;or&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;isBasemapLayer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;#I have to exclude group layers and basemaps of course.....&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dataSource&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;','&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'='&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'SQL Server'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# basically if the layer has a sql server data source&lt;/SPAN&gt;
                new_conn_prop &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;connectionProperties
                new_conn_prop&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'connection_info'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'user'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; newUser
                new_conn_prop&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'connection_info'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'password'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; newUserPass
                &lt;SPAN class="comment token"&gt;# Now i can update the connection properties dictionary of the layer&lt;/SPAN&gt;
                lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateConnectionProperties&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;connectionProperties&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;new_conn_prop&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
                arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;' has been updated !'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

        &lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; NameError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;' does not have  a sql server data source'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alberto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:40:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519990#M40741</guid>
      <dc:creator>AlbertoAloe</dc:creator>
      <dc:date>2021-12-11T22:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519991#M40742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I too was running into the same issue where the data source was not getting changed when using a .sde file.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I changed tactics and did as &lt;A href="https://community.esri.com/migrated-users/6642"&gt;Alberto Aloe&lt;/A&gt;&amp;nbsp;suggested and it worked like a charm.&amp;nbsp; I even noticed that the script was running a little slower as it churned through each layer in each map, so I could tell that it was doing something.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Oct 2019 20:36:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519991#M40742</guid>
      <dc:creator>BrianCunningham2</dc:creator>
      <dc:date>2019-10-01T20:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519992#M40743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Starting at ArcGIS version 2.6, we improved this workflow so that you can use Enterprise Geodatabase Connection Files in the first parameter of the UpdateConnectionProperties function. You can now&amp;nbsp;do something like the following code sample.&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy 
aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;'C:\Projects\YosemiteNP\Yosemite.aprx'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateConnectionProperties&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;'C:\Projects\YosemiteNP\DBConnections\TestGDB.sde'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
                                r&lt;SPAN class="string token"&gt;'C:\Projects\YosemiteNP\DBConnections\ProductionGDB.sde'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;More info and code samples can be found here:&amp;nbsp;&lt;A href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fpro.arcgis.com%2Fen%2Fpro-app%2Farcpy%2Fmapping%2Fupdatingandfixingdatasources.htm" style="color: #287433; border: 0px; font-weight: inherit; text-decoration: none; font-size: 14px; padding: 0px calc(12px + 0.35ex) 0px 0px;" target="_blank"&gt;Updating and fixing data sources—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:40:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519992#M40743</guid>
      <dc:creator>JeffMoulds</dc:creator>
      <dc:date>2021-12-11T22:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519993#M40744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for reaching out to this Thread to let your users know of the enhancement to the arcpy.mp updateConnectionProperties. This functionality will surely simplify our code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Diana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2020 16:09:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519993#M40744</guid>
      <dc:creator>DianaBenedict1</dc:creator>
      <dc:date>2020-08-03T16:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519994#M40745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used the&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;aprx&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;updateConnectionProperties in ArcGIS PRO 2.6 runs very slow as it goes through all 
the layers that need to be change.  It takes about four minutes each layer and at some point
it does not give me error and just seats there spinning.  In ArcMap was a 100 times faster.
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;arcpy
&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;sys
CASE = sys.argv[&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;]
aprx = arcpy.mp.ArcGISProject(&lt;SPAN style="color: #6a8759;"&gt;"CURRENT"&lt;/SPAN&gt;)
aprx.updateConnectionProperties(&lt;SPAN style="color: #6a8759;"&gt;r"C:\GIS_WorkSpace\Geodatabase\CASES\Shapes"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;r"X:\PD_Notify\Labels-2020\\" &lt;/SPAN&gt;+ CASE)
&lt;SPAN style="color: #cc7832;"&gt;del &lt;/SPAN&gt;aprx&lt;/PRE&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:40:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519994#M40745</guid>
      <dc:creator>JorgeMorteo</dc:creator>
      <dc:date>2021-12-11T22:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519995#M40746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jorge, thanks for the feedback. Yes, we know in some cases referencing a project via CURRENT and executing updateConnectionProperties is slow. You can speed up the time by setting the validate parameter in updateConnectionProperties to False. It is also faster if you run the script out of the app. That being said, I havent seen speeds as slow as 4 mins per layer. What type of data are the layers?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:21:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519995#M40746</guid>
      <dc:creator>JeffMoulds</dc:creator>
      <dc:date>2020-09-28T17:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519996#M40747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;They are shapefiles.&amp;nbsp; I wonder if that is the problem.&amp;nbsp; Just to test, I am going export some of the shapefiles to Geodatabase and see if that is the problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:27:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/519996#M40747</guid>
      <dc:creator>JorgeMorteo</dc:creator>
      <dc:date>2020-09-28T17:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/1035581#M60338</link>
      <description>&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;Does updateConnectionProperties require that feature class name in old and new be the same?&lt;/P&gt;&lt;P&gt;I have the situation where we have moved a number of feature classes from file geodatabase to sde, but the feature classes have also been renamed in sde to conform to corporate standards. So, for example:&lt;/P&gt;&lt;P&gt;before:&amp;nbsp; Data.gdb\roads; after: database.sde\transportation&lt;/P&gt;&lt;P&gt;before: Data.gdb\rivers; after: database.sde\hydrology&lt;/P&gt;&lt;P&gt;Is it possible to fix these broken links using updateConnectionProperties. Seemed pretty easy to do this in arcMap, just starting to see how/if it will be possible to accomplish the same in Pro.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 18:27:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/1035581#M60338</guid>
      <dc:creator>ChrisHolmes</dc:creator>
      <dc:date>2021-03-11T18:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/1111204#M62782</link>
      <description>&lt;P&gt;Though share my experience here. I had the same issue where using&amp;nbsp;&lt;EM&gt;updateConnectionProperties(l.connectionProperties, newConnectionProperties)&amp;nbsp;&lt;/EM&gt;on updating Layer data source from one FileGDB to another FileGDB didn't work. the process returned successful message without any warning. Couldn't work out why for a while. After adding&amp;nbsp;&lt;SPAN&gt;validate=false and run again, the layer became broken, and that's because the new FileGDB doesn't have the same feature class that the layer referred to. After sorting the feature class issue, the function works as expected.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The help doc says&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Validate: If set to&amp;nbsp;&lt;SPAN class=""&gt;True&lt;/SPAN&gt;, the connection properties will only be updated if the&amp;nbsp;&lt;SPAN class=""&gt;new_connection_info&lt;/SPAN&gt;&amp;nbsp;value is a valid connection. If it is not valid, the connection will not be replaced.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;I would thought it would be necessary to improve the &lt;EM&gt;updateConnectionProperties &lt;/EM&gt;function that when &lt;EM&gt;validate&lt;/EM&gt; is True, and if the new connection is invalid, it should return a warning to make the user's attention.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 11:21:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/1111204#M62782</guid>
      <dc:creator>JackFanZhang</dc:creator>
      <dc:date>2021-10-26T11:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/1209557#M65486</link>
      <description>&lt;P&gt;Here I am in 2022 with ArcGIS Pro 3.01 installed still looking to see why it does not work with a couple of simple file geodatabases!&lt;/P&gt;</description>
      <pubDate>Sun, 04 Sep 2022 10:45:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/1209557#M65486</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2022-09-04T10:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/1266450#M67052</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying as well to use the updateConnectionProperties function. Just in its most basic form, linking a new file geodatabase to an existing .aprx. Old and new databases have exactly the same structure. In my case, the function changes correctly the path's within the .aprx file. But when I open the .aprx it gives my only broken layer connections. When I click the&amp;nbsp;red-exclamation mark and direct to &lt;STRONG&gt;exactly the same&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;location/feature class&lt;/STRONG&gt; it retrieves the data.&lt;/P&gt;&lt;P&gt;My question: Why does the red-exclamation mark appears if the path is set correctly? Why can't the .aprx file represent the data when opening it?&lt;/P&gt;&lt;P&gt;The code I'm using:&lt;/P&gt;&lt;P&gt;aprx = arcpy.mp.ArcGISProject(path_Template_aprxFile)&lt;/P&gt;&lt;P&gt;aprx.updateConnectionProperties(None, path_newDatabase)&lt;/P&gt;&lt;P&gt;aprx.saveACopy(path_New_aprxFile)&lt;/P&gt;&lt;P&gt;If anyone can help solving my problem, be welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 15:37:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/1266450#M67052</guid>
      <dc:creator>RutgerDujardin</dc:creator>
      <dc:date>2023-03-10T15:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy Layer updateConnectionProperties not working as expected</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/1281846#M67503</link>
      <description>&lt;P&gt;Applied strategy to solve my problem. Updating the connection for each layer separately:&lt;/P&gt;&lt;P&gt;aprx = arcpy.mp.ArcGISProject(&lt;SPAN&gt;path_Template_aprxFile&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;for m in aprx.listMaps():&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;for layer in m.listLayers():&lt;BR /&gt;newCP = layer.connectionProperties&lt;BR /&gt;newCP['connection_info']['database'] =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;path_newDatabase&lt;/SPAN&gt;&lt;BR /&gt;layer.updateConnectionProperties(layer.connectionProperties, newCP)&lt;BR /&gt;aprx.saveACopy(&lt;SPAN&gt;path_New_aprxFile&lt;/SPAN&gt;)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2023 14:30:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-layer-updateconnectionproperties-not-working/m-p/1281846#M67503</guid>
      <dc:creator>RutgerDujardin</dc:creator>
      <dc:date>2023-04-24T14:30:46Z</dc:date>
    </item>
  </channel>
</rss>

