<?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 updateConnectionProperties doesn't work in group layers? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/updateconnectionproperties-doesn-t-work-in-group/m-p/1503143#M71018</link>
    <description>&lt;P&gt;ArcGIS pro 3.3.1 here I have a map with some group layers.&amp;nbsp; Inside the group layers there are layers pointing to two different filegeodatabase.&amp;nbsp; I need to update one on the fgdbs (the old database) for the entire map and leave the other (otherdatabase) one intact.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I am trying to use&amp;nbsp;updateConnectionProperties&lt;SPAN&gt;&amp;nbsp;with the old and the new fgdb but the problem is as soon as a layer where the source is the fgdb I am NOT updating, it stops updating the layers below.&amp;nbsp; So it will do the first few layers then stop and leave the ones at the bottom with the original database.&amp;nbsp; If I take the layers out of group or if I place the ones that I am not changing below, it works.&amp;nbsp; Changing the order is not practical.&amp;nbsp; &amp;nbsp;The schema of the old and the new database is identical.&amp;nbsp; The other database is different.&amp;nbsp; Everything is on the local workstation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;aprx = arcpy.mp.ArcGISProject('CURRENT')&lt;BR /&gt;mymap = aprx.activeMap&lt;BR /&gt;mymap.updateConnectionProperties(current_connection_info=r'C:\oldpath\database.gdb', new_connection_info=r'C:\newpath\database.gdb', ignore_case=True)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlexanderGray_0-1720547567670.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109219i3D9BE36683C9D8E9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlexanderGray_0-1720547567670.png" alt="AlexanderGray_0-1720547567670.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jul 2024 18:03:54 GMT</pubDate>
    <dc:creator>AlexanderGray</dc:creator>
    <dc:date>2024-07-09T18:03:54Z</dc:date>
    <item>
      <title>updateConnectionProperties doesn't work in group layers?</title>
      <link>https://community.esri.com/t5/python-questions/updateconnectionproperties-doesn-t-work-in-group/m-p/1503143#M71018</link>
      <description>&lt;P&gt;ArcGIS pro 3.3.1 here I have a map with some group layers.&amp;nbsp; Inside the group layers there are layers pointing to two different filegeodatabase.&amp;nbsp; I need to update one on the fgdbs (the old database) for the entire map and leave the other (otherdatabase) one intact.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I am trying to use&amp;nbsp;updateConnectionProperties&lt;SPAN&gt;&amp;nbsp;with the old and the new fgdb but the problem is as soon as a layer where the source is the fgdb I am NOT updating, it stops updating the layers below.&amp;nbsp; So it will do the first few layers then stop and leave the ones at the bottom with the original database.&amp;nbsp; If I take the layers out of group or if I place the ones that I am not changing below, it works.&amp;nbsp; Changing the order is not practical.&amp;nbsp; &amp;nbsp;The schema of the old and the new database is identical.&amp;nbsp; The other database is different.&amp;nbsp; Everything is on the local workstation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;aprx = arcpy.mp.ArcGISProject('CURRENT')&lt;BR /&gt;mymap = aprx.activeMap&lt;BR /&gt;mymap.updateConnectionProperties(current_connection_info=r'C:\oldpath\database.gdb', new_connection_info=r'C:\newpath\database.gdb', ignore_case=True)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlexanderGray_0-1720547567670.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109219i3D9BE36683C9D8E9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlexanderGray_0-1720547567670.png" alt="AlexanderGray_0-1720547567670.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 18:03:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updateconnectionproperties-doesn-t-work-in-group/m-p/1503143#M71018</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2024-07-09T18:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: updateConnectionProperties doesn't work in group layers?</title>
      <link>https://community.esri.com/t5/python-questions/updateconnectionproperties-doesn-t-work-in-group/m-p/1503176#M71023</link>
      <description>&lt;P&gt;Maybe use the group layers name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import arcpy

# Paths to the old and new geodatabases
old_geodatabase_path = r"C:\path\to\old\geodatabase.gdb"
new_geodatabase_path = r"C:\path\to\new\geodatabase.gdb"

# Define the path to your map document
mxd_path = r"C:\path\to\your\Text.mxd"

# Group layer names that need their layers' connections updated
target_group_layer_names = ["GroupLayer1", "GroupLayer2"]

mxd = arcpy.mapping.MapDocument(mxd_path)

# update connection properties for layers within a group layer
def update_layer_connection_properties(layer, old_path, new_path):
    if layer.isGroupLayer:
        for sublayer in layer:
            if sublayer.supports("dataSource"):
                sublayer.replaceDataSource(new_path, "FILEGDB_WORKSPACE")

# Iterate over each data frame in the map document
for df in arcpy.mapping.ListDataFrames(mxd):
    for layer in arcpy.mapping.ListLayers(mxd, "", df):
        if layer.isGroupLayer and layer.name in target_group_layer_names:
            update_layer_connection_properties(layer, old_geodatabase_path, new_geodatabase_path)
    
    # update the data frame source if needed
    df.updateConnectionProperties(old_geodatabase_path, new_geodatabase_path)


mxd.save()

# Clean up
del mxd&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 18:25:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updateconnectionproperties-doesn-t-work-in-group/m-p/1503176#M71023</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2024-07-09T18:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: updateConnectionProperties doesn't work in group layers?</title>
      <link>https://community.esri.com/t5/python-questions/updateconnectionproperties-doesn-t-work-in-group/m-p/1503193#M71024</link>
      <description>&lt;P&gt;this sort of works but some layers are not in group layers at all.&amp;nbsp; &amp;nbsp;I can just get all the layers from the map and then iterate through each one and check if supports('datasource') and attempt to change regardless of source database.&amp;nbsp; I still don't know why it doesn't work on the map though.&amp;nbsp; I used&amp;nbsp;updateConnectionProperties on the layer.&amp;nbsp; That way if the source is the other fgdb it won't do anything.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 19:03:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updateconnectionproperties-doesn-t-work-in-group/m-p/1503193#M71024</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2024-07-09T19:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: updateConnectionProperties doesn't work in group layers?</title>
      <link>https://community.esri.com/t5/python-questions/updateconnectionproperties-doesn-t-work-in-group/m-p/1503203#M71025</link>
      <description>&lt;P&gt;Maybe this is a bug in how updateConnectionProperties() works on workspaces. I have had luck iterating over each layer rather than applying to the whole map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for layer in mymap.listLayers():
    layer.updateConnectionProperties(
        current_connection_info=r'C:\oldpath\database.gdb',
        new_connection_info=r'C:\newpath\database.gdb',
        ignore_case=True
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 19:10:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updateconnectionproperties-doesn-t-work-in-group/m-p/1503203#M71025</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2024-07-09T19:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: updateConnectionProperties doesn't work in group layers?</title>
      <link>https://community.esri.com/t5/python-questions/updateconnectionproperties-doesn-t-work-in-group/m-p/1684467#M75116</link>
      <description>&lt;P&gt;Just ran into this bug in 3.4.3. In my case, I was trying to use the updateConnectionProperties method of the ArcGISProject object to repath multiple layers on different maps (like you can do from the Catalog view in Pro). I couldn't understand how it could update one layer and fail to update another, when both layers are in the same map and have the same source database. But we do have a lot of group layers, so that must be it.&lt;BR /&gt;&lt;BR /&gt;Guess it's back to listLayers and lyr.supports("dataSource") for me...&lt;/P&gt;</description>
      <pubDate>Fri, 13 Feb 2026 23:07:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updateconnectionproperties-doesn-t-work-in-group/m-p/1684467#M75116</guid>
      <dc:creator>AndrewBryson1</dc:creator>
      <dc:date>2026-02-13T23:07:18Z</dc:date>
    </item>
  </channel>
</rss>

