<?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 Updating the data source of a query layer with ArcPy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/updating-the-data-source-of-a-query-layer-with/m-p/294388#M22784</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using ArcPy to update data sources of all layers across several MXDs using (1) findAndReplaceWorkspacePaths() and (2) replaceDataSource().&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The workspace path, and dataset name,&amp;nbsp;seem to update fine when I run my script, but the database connection (right-click on layer -&amp;gt; Properties -&amp;gt; Change Query -&amp;gt; Connections... -&amp;gt; Edit... -&amp;gt; Database) does not, and the layer can not find the data to display because it is using the old database connection and not using the newly directed workspace path.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I change the workspace path, not see any error, and have the layer metadata (workspace and dataset name = data source) reflect the updates in layer properties, but&amp;nbsp;the database connection isn't actually updating? Is there a property or method that I am missing? Can I do something with the system tables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should also note that I can indeed update the database connection and have the data show up in ArcMap, but I have go to each query layer properties &lt;SPAN&gt;(right-click on layer -&amp;gt; Properties -&amp;gt; Change Query -&amp;gt; Connections... -&amp;gt; Edit... -&amp;gt; Database)&amp;nbsp;&lt;/SPAN&gt;and update it manually (like outlined here &lt;A class="link-titled" href="https://desktop.arcgis.com/en/arcmap/10.6/map/working-with-layers/modifying-a-query-layer.htm" title="https://desktop.arcgis.com/en/arcmap/10.6/map/working-with-layers/modifying-a-query-layer.htm"&gt;Modifying a query layer—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;), but I need to do this programmatically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any insight or recommendations?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Jan 2020 16:26:52 GMT</pubDate>
    <dc:creator>AlexanderSt__John</dc:creator>
    <dc:date>2020-01-21T16:26:52Z</dc:date>
    <item>
      <title>Updating the data source of a query layer with ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/updating-the-data-source-of-a-query-layer-with/m-p/294388#M22784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using ArcPy to update data sources of all layers across several MXDs using (1) findAndReplaceWorkspacePaths() and (2) replaceDataSource().&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The workspace path, and dataset name,&amp;nbsp;seem to update fine when I run my script, but the database connection (right-click on layer -&amp;gt; Properties -&amp;gt; Change Query -&amp;gt; Connections... -&amp;gt; Edit... -&amp;gt; Database) does not, and the layer can not find the data to display because it is using the old database connection and not using the newly directed workspace path.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I change the workspace path, not see any error, and have the layer metadata (workspace and dataset name = data source) reflect the updates in layer properties, but&amp;nbsp;the database connection isn't actually updating? Is there a property or method that I am missing? Can I do something with the system tables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should also note that I can indeed update the database connection and have the data show up in ArcMap, but I have go to each query layer properties &lt;SPAN&gt;(right-click on layer -&amp;gt; Properties -&amp;gt; Change Query -&amp;gt; Connections... -&amp;gt; Edit... -&amp;gt; Database)&amp;nbsp;&lt;/SPAN&gt;and update it manually (like outlined here &lt;A class="link-titled" href="https://desktop.arcgis.com/en/arcmap/10.6/map/working-with-layers/modifying-a-query-layer.htm" title="https://desktop.arcgis.com/en/arcmap/10.6/map/working-with-layers/modifying-a-query-layer.htm"&gt;Modifying a query layer—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;), but I need to do this programmatically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any insight or recommendations?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jan 2020 16:26:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-the-data-source-of-a-query-layer-with/m-p/294388#M22784</guid>
      <dc:creator>AlexanderSt__John</dc:creator>
      <dc:date>2020-01-21T16:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: Updating the data source of a query layer with ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/updating-the-data-source-of-a-query-layer-with/m-p/1301526#M68008</link>
      <description>&lt;P&gt;Looking for the same thing here&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 14:40:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-the-data-source-of-a-query-layer-with/m-p/1301526#M68008</guid>
      <dc:creator>RoyJackson_AlertMedia</dc:creator>
      <dc:date>2023-06-21T14:40:29Z</dc:date>
    </item>
  </channel>
</rss>

