<?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: issues updating data source via arcpy.mapping in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/issues-updating-data-source-via-arcpy-mapping/m-p/1672#M40</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This issue has been fixed and will be available with SP3.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Jeff&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Woot! Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 May 2011 16:36:40 GMT</pubDate>
    <dc:creator>RuthEmerick</dc:creator>
    <dc:date>2011-05-31T16:36:40Z</dc:date>
    <item>
      <title>issues updating data source via arcpy.mapping</title>
      <link>https://community.esri.com/t5/mapping-questions/issues-updating-data-source-via-arcpy-mapping/m-p/1667#M35</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am running the python script listed at the bottom of this message to update the data source of many layers included in one of my .mxd's.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Although the script loops though all layers in the map, the data source is only updated in the first 37 layers of more than 350 in the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;All layers I am trying to point to are stored in SDE in a single SQL Server 2005 database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;After running the Pyhton script in ArcMap, I intermittently get an error message for my SDE connection saying that "Maximum number of connections to instance exceeded". Perhaps the "lyr.replaceDataSource " method tries to connect multiple times to SDE and runs out of connections.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any assistance would be greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Roberto&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument("CURRENT")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for lyr in arcpy.mapping.ListLayers(mxd):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.isFeatureLayer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wrkspcpath = r"C:\Documents and Settings\rfiguero\Application Data\ESRI\Desktop10.0\ArcCatalog\cmtni_emili_sde_SYSTEST.sde"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; old_dataname = lyr.datasetName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_dataname = old_dataname + '_1'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.replaceDataSource (wrkspcpath, "SDE_WORKSPACE", new_dataname)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print wrkspcpath, new_dataname&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Feb 2011 18:32:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/issues-updating-data-source-via-arcpy-mapping/m-p/1667#M35</guid>
      <dc:creator>RobertoFigueroa</dc:creator>
      <dc:date>2011-02-16T18:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: issues updating data source via arcpy.mapping</title>
      <link>https://community.esri.com/t5/mapping-questions/issues-updating-data-source-via-arcpy-mapping/m-p/1668#M36</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We are aware of this issue and are working on a fix.&amp;nbsp; It won't be available for SP2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to support some workflows we did not recycle SDE connections with each lyr iteration so lyr.replaceDataSources is creating a new SDE connection with each iteration.&amp;nbsp; The cache is cleared when the script stops running or sometimes when you delete the variable references.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Some workarounds are to: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Try deleting the lyr variable at the end of each loop.&amp;nbsp; This does not always work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Increase the number of available SDE connections on your server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Decrease the number of layers that are updated within a single loop/script.&amp;nbsp; One example may be that your script iterates through 25 layers at a time.&amp;nbsp; You could have one master script that calls each subscript.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Feb 2011 13:34:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/issues-updating-data-source-via-arcpy-mapping/m-p/1668#M36</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2011-02-17T13:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: issues updating data source via arcpy.mapping</title>
      <link>https://community.esri.com/t5/mapping-questions/issues-updating-data-source-via-arcpy-mapping/m-p/1669#M37</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeff, is there any chance setting up direct connections to the SDE would help with this? I've run into the same problem as Roberto.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 16:50:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/issues-updating-data-source-via-arcpy-mapping/m-p/1669#M37</guid>
      <dc:creator>RuthEmerick</dc:creator>
      <dc:date>2011-03-17T16:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: issues updating data source via arcpy.mapping</title>
      <link>https://community.esri.com/t5/mapping-questions/issues-updating-data-source-via-arcpy-mapping/m-p/1670#M38</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We can reproduce this issue an will hopefully be able to address it in the next service pack.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to check its status, it is: NIM067157&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Apr 2011 20:02:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/issues-updating-data-source-via-arcpy-mapping/m-p/1670#M38</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2011-04-15T20:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: issues updating data source via arcpy.mapping</title>
      <link>https://community.esri.com/t5/mapping-questions/issues-updating-data-source-via-arcpy-mapping/m-p/1671#M39</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This issue has been fixed and will be available with SP3.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2011 16:58:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/issues-updating-data-source-via-arcpy-mapping/m-p/1671#M39</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2011-05-10T16:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: issues updating data source via arcpy.mapping</title>
      <link>https://community.esri.com/t5/mapping-questions/issues-updating-data-source-via-arcpy-mapping/m-p/1672#M40</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This issue has been fixed and will be available with SP3.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Jeff&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Woot! Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2011 16:36:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/issues-updating-data-source-via-arcpy-mapping/m-p/1672#M40</guid>
      <dc:creator>RuthEmerick</dc:creator>
      <dc:date>2011-05-31T16:36:40Z</dc:date>
    </item>
  </channel>
</rss>

