<?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: Update data sources.  enterprise server.  dictionary. updateConnectionProperties in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1490654#M70796</link>
    <description>&lt;P&gt;Worked like a champ....&amp;nbsp; !!&amp;nbsp; Much Obliged.... !!&lt;/P&gt;&lt;P&gt;-Steve&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2024 15:38:55 GMT</pubDate>
    <dc:creator>SGTomlins</dc:creator>
    <dc:date>2024-06-12T15:38:55Z</dc:date>
    <item>
      <title>Update data sources.  enterprise server.  dictionary. updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1405693#M70254</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;I have successfully updated connection properties in all scenarios EXCEPT enterprise to enterprise (dev to production).&amp;nbsp; The following code is my example.&amp;nbsp; I have 2.9 (yes i know outdated)&amp;nbsp; Python 1.9.1 ( again. outdated).&lt;/P&gt;&lt;P&gt;Is this a limitation of the&amp;nbsp;&lt;SPAN&gt;updateConnectionProperties?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is this related the attached screenshot, where the Update Data Sources is full of "Unsupported Items"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Feel like I am missing something obvious...&amp;nbsp; ?&amp;nbsp; &amp;nbsp;help...&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;arcpy&lt;SPAN&gt;,&lt;/SPAN&gt;pprint&lt;BR /&gt;&lt;SPAN&gt;# ## SGTomlins  3/27/24&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# ## Examples of workspaces that can be used.  Either a .gdb or a connection string.&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# ## arcpy.env.workspace = r"C:\SGT\ESRI\ArcGIS_Pro\LoadLayerFiles\LoadLayerFiles.gdb"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# ## arcpy.env.workspace = r"C:\SGT\ESRI\_ConnectStrings\SDE@underdog-az@gis_prod_util_test.sde"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;#&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# ## find_dict = r'C:\SGT\SDE@underdog-az@gis_prod_util_test.sde.gdb'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# ## replace_dict = r'C:\Data\!Database_Connections\GISReader@underdog-az@gis_prod_util.sde'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;find_dict = {&lt;SPAN&gt;'connection_info'&lt;/SPAN&gt;: {&lt;SPAN&gt;'user'&lt;/SPAN&gt;: &lt;SPAN&gt;'sde'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;'password'&lt;/SPAN&gt;: &lt;SPAN&gt;'guessmenow!'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;'version'&lt;/SPAN&gt;: &lt;SPAN&gt;'sde.DEFAULT'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;'server'&lt;/SPAN&gt;: &lt;SPAN&gt;'underdog-az'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;'instance'&lt;/SPAN&gt;: &lt;SPAN&gt;'sde:sqlserver:underdog-az'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;'dbclient'&lt;/SPAN&gt;: &lt;SPAN&gt;'sqlserver'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;'database' &lt;/SPAN&gt;: &lt;SPAN&gt;'gis_prod_util'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                &lt;SPAN&gt;'db_connection_properties' &lt;/SPAN&gt;: &lt;SPAN&gt;'underdog-az'&lt;BR /&gt;&lt;/SPAN&gt;                                 }}&lt;BR /&gt;&lt;BR /&gt;replace_dict ={&lt;SPAN&gt;'connection_info'&lt;/SPAN&gt;: {&lt;SPAN&gt;'user'&lt;/SPAN&gt;: &lt;SPAN&gt;'sde'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;'password'&lt;/SPAN&gt;: &lt;SPAN&gt;'guessmelater'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;'version'&lt;/SPAN&gt;: &lt;SPAN&gt;'sde.DEFAULT'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;'server'&lt;/SPAN&gt;: &lt;SPAN&gt;'tinkerbell-az'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;'instance'&lt;/SPAN&gt;: &lt;SPAN&gt;'sde:sqlserver:tinkerbell-az\TINKER2019'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;'dbclient'&lt;/SPAN&gt;: &lt;SPAN&gt;'sqlserver'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;'database' &lt;/SPAN&gt;: &lt;SPAN&gt;'gis_prod_util'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;'db_connection_properties' &lt;/SPAN&gt;: &lt;SPAN&gt;'tinkerbell-az'&lt;BR /&gt;&lt;/SPAN&gt;                                 }}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# ## sets some variables and the output path for the created .lyrx files&lt;BR /&gt;&lt;/SPAN&gt;aprfilenew = &lt;SPAN&gt;r'c:\SGT\TINKER2019-ResourceNoUtil31.aprx'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# ## Set your ArcGIS Project to excute the code on.&lt;BR /&gt;&lt;/SPAN&gt;aprfilein = &lt;SPAN&gt;r'c:\SGT\TINKER2019-Resource_NoUtil.aprx'&lt;BR /&gt;&lt;/SPAN&gt;p = arcpy.mp.ArcGISProject(aprfilein)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# ## Create lists for "Maps" and "Layers" in the .aprx&lt;BR /&gt;&lt;/SPAN&gt;cnt=&lt;SPAN&gt;1&lt;BR /&gt;&lt;/SPAN&gt;aprx = arcpy.mp.ArcGISProject(aprfilein)&lt;BR /&gt;&lt;SPAN&gt;for &lt;/SPAN&gt;m &lt;SPAN&gt;in &lt;/SPAN&gt;aprx.listMaps():&lt;BR /&gt;    &lt;SPAN&gt;for &lt;/SPAN&gt;lyr &lt;SPAN&gt;in &lt;/SPAN&gt;m.listLayers():&lt;BR /&gt;        &lt;SPAN&gt;print &lt;/SPAN&gt;(lyr)&lt;BR /&gt;        lyr.updateConnectionProperties(find_dict&lt;SPAN&gt;, &lt;/SPAN&gt;replace_dict)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# ## Return the values of variable to the screen&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"working on it"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# ## Save a copy of the .aprx used in the code above.&lt;BR /&gt;&lt;/SPAN&gt;p.saveACopy(aprfilenew)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print &lt;/SPAN&gt;(&lt;SPAN&gt;"."&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;print &lt;/SPAN&gt;(&lt;SPAN&gt;".."&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 04 Apr 2024 13:27:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1405693#M70254</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-04-04T13:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Update data sources.  enterprise server.  dictionary. updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1407105#M70273</link>
      <description>&lt;P&gt;Just grasping at straws..&amp;nbsp; this did not work either....&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;find_dict = {'connection_info': {'authentication_mode': 'DBMS',&lt;BR /&gt;'database': 'gis_prod_util',&lt;BR /&gt;'db_connection_properties': 'underdog-az',&lt;BR /&gt;'dbclient': 'sqlserver',&lt;BR /&gt;'instance': 'sde:sqlserver:underdog-az',&lt;BR /&gt;'password': 'blahblahblah!',&lt;BR /&gt;'server': 'underdog-az',&lt;BR /&gt;'user': 'sde',&lt;BR /&gt;'version': 'sde.DEFAULT'},&lt;BR /&gt;'dataset': lyr ,&lt;BR /&gt;'workspace_factory': 'FeatureService'}&lt;/P&gt;&lt;P&gt;# } #,&lt;BR /&gt;# 'workspace_factory': 'SDE'}}&lt;/P&gt;&lt;P&gt;replace_dict = {'connection_info': {'authentication_mode': 'DBMS',&lt;BR /&gt;'database': 'gis_prod_util',&lt;BR /&gt;'db_connection_properties': 'tinkerbell-az',&lt;BR /&gt;'dbclient': 'sqlserver',&lt;BR /&gt;'instance': 'sde:sqlserver:tinkerbell-az\TINKER2019',&lt;BR /&gt;'password': 'noropeheredude!',&lt;BR /&gt;'server': 'tinkerbell-az',&lt;BR /&gt;'user': 'sde',&lt;BR /&gt;'version': 'sde.DEFAULT'},&lt;BR /&gt;'dataset': lyr,&lt;BR /&gt;'workspace_factory': 'FeatureService'}&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2024 13:13:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1407105#M70273</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-04-08T13:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Update data sources.  enterprise server.  dictionary. updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1476199#M70628</link>
      <description>&lt;DIV&gt;&lt;STRONG&gt;Issue:&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Updating data sources for feature services failed when using a Python script in ArcGIS Pro.&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Resolution:&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Logged a defect (BUG-000167099) since the issue could be reproduced internally.&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 21 May 2024 12:31:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1476199#M70628</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-05-21T12:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Update data sources.  enterprise server.  dictionary. updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1479853#M70680</link>
      <description>&lt;P&gt;I'm not aware of any bugs when updating the data sources of enterprise geodatabase layers between DEV and PROD. Have you tried this syntax:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Project/Map/Layer/Table.updateConnectionProperties('DEV.sde', 'PROD.sde')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;That syntax is easier than the connectionProperties dictionary. However, the dictionary workflow should work. If you need to stick with that dict workflow, can you give me more info about your layers? Make a new project with a map that just has 1.) a DEV layer, and, 2.) the corresponding PROD layer. Then run this script, and let me know what the output of the print statements are. Also, are the user names/passwords the same between DEV and PROD?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcpy.cim.__init__ import GetJSONForCIMObject

aprx = arcpy.mp.ArcGISProject('current')
m = aprx.listMaps()[0]
lyr = m.listLayers('MY DEV LAYER NAME')[0]
c = lyr.getDefinition('V2')
dc = c.featureTable.dataConnection
j = GetJSONForCIMObject(dc, 'V2')
print(j)

lyr = m.listLayers('MY PROD LAYER NAME')[0]
c = lyr.getDefinition('V2')
dc = c.featureTable.dataConnection
j = GetJSONForCIMObject(dc, 'V2')
print(j)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you also send me screen shots of Layer &amp;gt; Properties &amp;gt; Source for both the DEV and PROD layers? Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2024 21:49:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1479853#M70680</guid>
      <dc:creator>JeffMoulds</dc:creator>
      <dc:date>2024-05-28T21:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Update data sources.  enterprise server.  dictionary. updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1488199#M70769</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1135"&gt;@JeffMoulds&lt;/a&gt;&amp;nbsp;, I just saw this today.&amp;nbsp; &amp;nbsp;Went looking after I got the email about the bug not being "reproducible".&amp;nbsp; I will take your direction and proceed.&amp;nbsp; Thanks for the follow-up.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 12:20:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1488199#M70769</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-06-10T12:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Update data sources.  enterprise server.  dictionary. updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1488302#M70773</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1135"&gt;@JeffMoulds&lt;/a&gt;&amp;nbsp; Attached are the screen shots and python output you asked for.&lt;/P&gt;&lt;P&gt;I have tried this.&amp;nbsp; I am SAML connected to the Portal that loads each the PROD and DEV. So I believe I am connected same/same.&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;# ## SGTomlins  6/10/24&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;aprfilenew = &lt;SPAN&gt;r'C:\SGT\ESRI\Python\ChangeSource\JMoulds2\JMoulds2_99.aprx'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# ## Set your ArcGIS Project to excute the code on.&lt;BR /&gt;&lt;/SPAN&gt;aprfilein = &lt;SPAN&gt;r'C:\SGT\ESRI\Python\ChangeSource\JMoulds2\JMoulds2.aprx'&lt;BR /&gt;&lt;/SPAN&gt;p = arcpy.mp.ArcGISProject(aprfilein)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# ## Execute the command to change the versions of the layers in the .aprx&lt;BR /&gt;&lt;/SPAN&gt;p.updateConnectionProperties(&lt;SPAN&gt;r'C:\SGT\ESRI\Python\ChangeSource\dc@TINKER2019@TRAD@gis_prod_util.sde'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;r'C:\SGT\ESRI\Python\ChangeSource\dc@underdog-az@gis_prod_util.sde'&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;DIV&gt;&lt;PRE&gt;p.saveACopy(aprfilenew)&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 10 Jun 2024 15:31:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1488302#M70773</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-06-10T15:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Update data sources.  enterprise server.  dictionary. updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1488437#M70780</link>
      <description>&lt;P&gt;Probably missing something obvious.&amp;nbsp; Particulars about the connection properties or user mis-understanding...&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;The JMoulds4.doc shows the connection properties for the Feature Service and same the Database feature.&amp;nbsp; I can make the following work on the Db connection but I cannot get a URL to old/new.&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;arcpy&lt;SPAN&gt;,&lt;/SPAN&gt;pprint&lt;BR /&gt;&lt;SPAN&gt;# ## SGTomlins  6/10/24&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;aprfilenew = &lt;SPAN&gt;r'C:\SGT\ESRI\Python\ChangeSource\JMoulds4_out.aprx'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# ## Set your ArcGIS Project to excute the code on.&lt;BR /&gt;&lt;/SPAN&gt;aprfilein = &lt;SPAN&gt;r'C:\SGT\ESRI\Python\ChangeSource\JMoulds4.aprx'&lt;BR /&gt;&lt;/SPAN&gt;p = arcpy.mp.ArcGISProject(aprfilein)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# ## Execute the command to change the versions of the layers in the .aprx&lt;BR /&gt;&lt;/SPAN&gt;p.updateConnectionProperties(&lt;SPAN&gt;r'C:\SGT\ESRI\Python\ChangeSource\SAML@underdog-az@gis_prod_util.sde'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;                                 &lt;SPAN&gt;r'C:\SGT\ESRI\Python\ChangeSource\SAML@tinker2019@gis_prod_util.sde'&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;p.saveACopy(aprfilenew)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;What is there to change or use for the URL old/new update?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;-Steve&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 10 Jun 2024 18:57:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1488437#M70780</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-06-10T18:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: Update data sources.  enterprise server.  dictionary. updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1488573#M70784</link>
      <description>&lt;P&gt;Steve,&lt;/P&gt;&lt;P&gt;I'm glad you were able to get the enterprise geodatabase workflow to work. E.g.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Project/Map/Layer/Table.updateConnectionProperties('DEV.sde', 'PROD.sde')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding using the same code pattern for updating Feature Service URLs, e.g.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Layer.updateConnectionProperties(DevURL, ProdURL)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you able to upgrade your version of ArcGIS Pro to version 3.2 or higher? That's the version we added support for updating URLs. If you are unable to upgrade, I can show you a CIM workaround.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 23:36:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1488573#M70784</guid>
      <dc:creator>JeffMoulds</dc:creator>
      <dc:date>2024-06-10T23:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: Update data sources.  enterprise server.  dictionary. updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1488856#M70786</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1135"&gt;@JeffMoulds&lt;/a&gt;&amp;nbsp; The CIM would be helpful.&amp;nbsp; We are bound by some legacy software version in-compatibility and an upgrade is pending and especially needed.&amp;nbsp; I am setting up 3.2 / 10.9 on the dev environment.&amp;nbsp; Hence,&amp;nbsp; transferring connection properties between equipment is very handy.I take the working PROD and stand it up in DEV and updateconnections...&amp;nbsp; when it is done, I send it back.&amp;nbsp; wash rinse repeat.&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;-Steve&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 12:41:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1488856#M70786</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-06-11T12:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Update data sources.  enterprise server.  dictionary. updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1490514#M70792</link>
      <description>&lt;P&gt;Steve, try the the following:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;aprx = arcpy.mp.ArcGISProject('current')
m = aprx.listMaps()[0]
# put your layer name here
lyr = m.listLayers('Water1')[0]
lyrCIM = lyr.getDefinition("V2")
# put your URL here
# note that it has to start with 'URL='
lyrCIM.featureTable.dataConnection.workspaceConnectionString = 'URL=https://services2.arcgis.com/k4wsDILUIGeQ5HvW/arcgis/rest/services/Water2/FeatureServer'
lyr.setDefinition(lyrCIM)&lt;/LI-CODE&gt;&lt;P&gt;This workaround uses the CIM. You can learn more about the CIM here:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And there are more sample of using the cim to update data sources here:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/updatingandfixingdatasources.htm#ESRI_SECTION1_DD16BE1F4AC54F078A04C84BD22C8D9B" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/updatingandfixingdatasources.htm#ESRI_SECTION1_DD16BE1F4AC54F078A04C84BD22C8D9B&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 14:22:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1490514#M70792</guid>
      <dc:creator>JeffMoulds</dc:creator>
      <dc:date>2024-06-12T14:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: Update data sources.  enterprise server.  dictionary. updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1490654#M70796</link>
      <description>&lt;P&gt;Worked like a champ....&amp;nbsp; !!&amp;nbsp; Much Obliged.... !!&lt;/P&gt;&lt;P&gt;-Steve&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 15:38:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1490654#M70796</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-06-12T15:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Update data sources.  enterprise server.  dictionary. updateConnectionProperties</title>
      <link>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1490840#M70798</link>
      <description>&lt;P&gt;Here is my "working" .py to accomplish my goal of re-sourcing URL's at while being constrained by Pro 2.x&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;arcpy&lt;SPAN&gt;,&lt;/SPAN&gt;pprint&lt;SPAN&gt;,&lt;/SPAN&gt;re&lt;BR /&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;arcpy.cim.&lt;SPAN&gt;__init__ &lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;GetJSONForCIMObject&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;datetime &lt;SPAN&gt;import &lt;/SPAN&gt;date&lt;SPAN&gt;, &lt;/SPAN&gt;datetime&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;time&lt;BR /&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;timeit &lt;SPAN&gt;import &lt;/SPAN&gt;default_timer &lt;SPAN&gt;as &lt;/SPAN&gt;timer&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#  ## Set a bunch of variables&lt;BR /&gt;&lt;/SPAN&gt;StartTime = datetime.now()&lt;BR /&gt;start = timer()&lt;BR /&gt;today = date.today()&lt;BR /&gt;d1 = today.strftime(&lt;SPAN&gt;"%Y%m%d"&lt;/SPAN&gt;)&lt;BR /&gt;now = datetime.now()&lt;BR /&gt;seconds = now.strftime(&lt;SPAN&gt;"%S"&lt;/SPAN&gt;)&lt;BR /&gt;milliseconds = (seconds * &lt;SPAN&gt;10&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;# Current Time&lt;BR /&gt;&lt;/SPAN&gt;Time = time.strftime(&lt;SPAN&gt;"%I:%M:%S %p"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;time.localtime())&lt;BR /&gt;&lt;SPAN&gt;# Current Day&lt;BR /&gt;&lt;/SPAN&gt;Day = time.strftime(&lt;SPAN&gt;"%m-%d-%Y"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;time.localtime())&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Create the logging file&lt;BR /&gt;&lt;/SPAN&gt;txtFile = &lt;SPAN&gt;open&lt;/SPAN&gt;(&lt;SPAN&gt;"c:\SGT\Logs\ChangeSrcDB_Connection_CIM.txt"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"a"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;'Count Feature classes: ' &lt;/SPAN&gt;+ &lt;SPAN&gt;str&lt;/SPAN&gt;(Day) + &lt;SPAN&gt;" " &lt;/SPAN&gt;+ &lt;SPAN&gt;str&lt;/SPAN&gt;(Time))&lt;BR /&gt;txtFile.write(&lt;SPAN&gt;'#####################################################################################' &lt;/SPAN&gt;+ &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;\n&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;)&lt;BR /&gt;txtFile.write(&lt;SPAN&gt;'Change connection properties started at: ' &lt;/SPAN&gt;+ &lt;SPAN&gt;str&lt;/SPAN&gt;(Day) + &lt;SPAN&gt;" " &lt;/SPAN&gt;+ &lt;SPAN&gt;str&lt;/SPAN&gt;(Time) + &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;\n&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;)&lt;BR /&gt;txtFile.write(&lt;SPAN&gt;'#####################################################################################'&lt;/SPAN&gt;)&lt;BR /&gt;txtFile.write(&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;\n&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;)&lt;BR /&gt;txtFile.close()&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# ## Set your ArcGIS Project to excute the code on.&lt;BR /&gt;&lt;/SPAN&gt;aprfilein = &lt;SPAN&gt;r'C:\SGT\ESRI\Python\ChangeSource\OriginalSourcePROD.aprx'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# ## Set the name of the aprx to be saved with new data sources&lt;BR /&gt;&lt;/SPAN&gt;aprfilenew = &lt;SPAN&gt;r'C:\SGT\ESRI\Python\ChangeSource\NewSourceDEV.aprx'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;p = arcpy.mp.ArcGISProject(aprfilein)&lt;BR /&gt;m = p.listMaps()[&lt;SPAN&gt;0&lt;/SPAN&gt;]&lt;BR /&gt;l = m.listLayers()[&lt;SPAN&gt;0&lt;/SPAN&gt;]&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# ## Set the new URL connection string&lt;BR /&gt;&lt;/SPAN&gt;urlprfx = &lt;SPAN&gt;'URL=https://tinkerbell-az.ci.janesville.wi.us/devserver/rest/services/'&lt;BR /&gt;&lt;/SPAN&gt;replaceurl = &lt;SPAN&gt;'URL=https://tinkerbell-az.ci.janesville.wi.us/devserver/rest/services/Utilities/Utilities/FeatureServer'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# Just having fun with example of taking string apart for use later.. not needed in this example&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;extract_base_url&lt;/SPAN&gt;(url):&lt;BR /&gt;    &lt;SPAN&gt;# Define the regex pattern to match the base URL&lt;BR /&gt;&lt;/SPAN&gt;    pattern = &lt;SPAN&gt;r"URL=(https?://[^/]+/[^/]+/[^/]+/[^/]+/[^/]+/[^/]+/)"&lt;BR /&gt;&lt;/SPAN&gt;    match = re.search(pattern&lt;SPAN&gt;, &lt;/SPAN&gt;url)&lt;BR /&gt;    &lt;SPAN&gt;if &lt;/SPAN&gt;match:&lt;BR /&gt;        &lt;SPAN&gt;return &lt;/SPAN&gt;match.group(&lt;SPAN&gt;1&lt;/SPAN&gt;)&lt;BR /&gt;    &lt;SPAN&gt;else&lt;/SPAN&gt;:&lt;BR /&gt;        &lt;SPAN&gt;return None&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# Get the Layer name, get some information to satisfy need for operation to change source url&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;for &lt;/SPAN&gt;lyr &lt;SPAN&gt;in &lt;/SPAN&gt;m.listLayers():&lt;BR /&gt;    &lt;SPAN&gt;#pprint.pprint(lyr.connectionProperties)&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    # with open (txtFile, 'a') as f:&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    #     pprint.pprint(lyr.connectionProperties, stream=f)&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    txtFile = &lt;SPAN&gt;open&lt;/SPAN&gt;(&lt;SPAN&gt;"c:\SGT\Logs\ChangeSrcDB_Connection_CIM.txt"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"a"&lt;/SPAN&gt;)&lt;BR /&gt;    txtFile.write(&lt;SPAN&gt;'The is the layer name: ' &lt;/SPAN&gt;+ &lt;SPAN&gt;str&lt;/SPAN&gt;(lyr))&lt;BR /&gt;    txtFile.write(&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;\n&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;)&lt;BR /&gt;    txtFile.write(&lt;SPAN&gt;' ------------------------------------------------------------------' &lt;/SPAN&gt;+ &lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;\n&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;)&lt;BR /&gt;    txtFile.close()&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;print &lt;/SPAN&gt;(&lt;SPAN&gt;'This is the layer name :' &lt;/SPAN&gt;+ &lt;SPAN&gt;str&lt;/SPAN&gt;(lyr))&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;# Get the layer definition information CIM&lt;BR /&gt;&lt;/SPAN&gt;    lyrCIM = lyr.getDefinition(&lt;SPAN&gt;"V2"&lt;/SPAN&gt;)&lt;BR /&gt;    c = lyr.getDefinition(&lt;SPAN&gt;'V2'&lt;/SPAN&gt;)&lt;BR /&gt;    dc = c.featureTable.dataConnection&lt;BR /&gt;    j = GetJSONForCIMObject(dc&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'V2'&lt;/SPAN&gt;)&lt;BR /&gt;    &lt;SPAN&gt;print&lt;/SPAN&gt;(j)&lt;BR /&gt;&lt;BR /&gt;    connstr = lyrCIM.featureTable.dataConnection.workspaceConnectionString&lt;BR /&gt;    &lt;SPAN&gt;print &lt;/SPAN&gt;(&lt;SPAN&gt;"This is the connection string from the CIM= " &lt;/SPAN&gt;+ connstr)&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;# Extract the base URL&lt;BR /&gt;&lt;/SPAN&gt;    base_url = extract_base_url(connstr)&lt;BR /&gt;    &lt;SPAN&gt;# This loop needs some error trapping or string reconstruction depending on the from/to you are using&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;if &lt;/SPAN&gt;base_url:&lt;BR /&gt;        &lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"Base URL:"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;base_url)&lt;BR /&gt;        &lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"Changing the CIM connection properties"&lt;/SPAN&gt;)&lt;BR /&gt;        &lt;SPAN&gt;# Change the URL data source&lt;BR /&gt;&lt;/SPAN&gt;        lyrCIM.featureTable.dataConnection.workspaceConnectionString = replaceurl&lt;BR /&gt;        lyr.setDefinition(lyrCIM)&lt;BR /&gt;        &lt;SPAN&gt;#lyrCIM = lyr.getDefinition("V2")&lt;BR /&gt;&lt;/SPAN&gt;        c = lyr.getDefinition(&lt;SPAN&gt;'V2'&lt;/SPAN&gt;)&lt;BR /&gt;        dc = c.featureTable.dataConnection&lt;BR /&gt;        j = GetJSONForCIMObject(dc&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'V2'&lt;/SPAN&gt;)&lt;BR /&gt;        &lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"J again" &lt;/SPAN&gt;+ j)&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;else&lt;/SPAN&gt;:&lt;BR /&gt;        &lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"Base URL not found."&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;'...... next .....'&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Save a copy of the new apr with it's newly sourced services.&lt;BR /&gt;&lt;/SPAN&gt;p.saveACopy(aprfilenew)&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 Jun 2024 17:56:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-data-sources-enterprise-server-dictionary/m-p/1490840#M70798</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-06-12T17:56:30Z</dc:date>
    </item>
  </channel>
</rss>

