<?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>idea Possibility to change query layer definition with arcpy (not definition query) in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idi-p/936245</link>
    <description>&lt;P&gt;Now I cannot do that. I need to change schema name (schema.tablename) in big set of symbolized layers. Repair datasource of course doesn't work, definition query is different thing as well. I realized that I can't automate my task with arcpy.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Oct 2023 22:05:38 GMT</pubDate>
    <dc:creator>PiotrIwaniuk</dc:creator>
    <dc:date>2023-10-17T22:05:38Z</dc:date>
    <item>
      <title>Possibility to change query layer definition with arcpy (not definition query)</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idi-p/936245</link>
      <description>&lt;P&gt;Now I cannot do that. I need to change schema name (schema.tablename) in big set of symbolized layers. Repair datasource of course doesn't work, definition query is different thing as well. I realized that I can't automate my task with arcpy.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 22:05:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idi-p/936245</guid>
      <dc:creator>PiotrIwaniuk</dc:creator>
      <dc:date>2023-10-17T22:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Possibility to change query layer definition with arcpy (not definition query)</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936246#M4281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Agree. Query Layers do not work well when things change such as the database, server or schema. Especially when they are part of map services. We basically have to recreate them between dev/test/production environments and its painful since there is no layer copy option to copy the layer properties for symbology, def queries, labeling, etc...&amp;nbsp;

&lt;!-- content transformation source ID: 00aE0000005Uwji --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 19:14:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936246#M4281</guid>
      <dc:creator>RonnieRichards</dc:creator>
      <dc:date>2014-02-13T19:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Possibility to change query layer definition with arcpy (not definition query)</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936247#M4282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Agree. Query Layers do not work well when things change such as the database, server or schema. Especially when they are part of map services. We basically have to recreate them between dev/test/production environments and its painful since there is no layer copy option to copy the layer properties for symbology, def queries, labeling, etc...&amp;nbsp;

&lt;!-- content transformation source ID: 00aE0000005Uwjn --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 19:14:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936247#M4282</guid>
      <dc:creator>RonnieRichards</dc:creator>
      <dc:date>2014-02-13T19:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Possibility to change query layer definition with arcpy (not definition query)</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936248#M4283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;This would be an extremely useful feature as my organization is looking to build an operational database using ST_Geometry where this data would be accessed in ArcGIS Server services and ArcMap layers using Query Layers.&amp;nbsp; The data would be stored in an Oracle database (11g to start) and my organization would eventually upgrade the database to Oracle 12c so the database connection informationof the query layers would need to be updated.

&lt;!-- content transformation source ID: 00aE0000005WvZF --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2014 16:05:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936248#M4283</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2014-03-14T16:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Possibility to change query layer definition with arcpy (not definition query)</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936249#M4284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Agree, missing arcpy automation functionality for changing query layer datasource and other properties. Very painfull when migrate between dev/test/prod environments, need to fix layer connections manually.

&lt;!-- content transformation source ID: 00aE0000006ElVB --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2014 05:58:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936249#M4284</guid>
      <dc:creator>VitalijusAgejevas1</dc:creator>
      <dc:date>2014-04-10T05:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Possibility to change query layer definition with arcpy (not definition query)</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936250#M4285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Agree. We are currently migrating from an Oracle 10g database to Oracle 11g and have many mxd's to update. Arcpy allows us to script and automate some of the layer&amp;nbsp;datasources, but we cannot totally automate the process due to this missing functionality.

&lt;!-- content transformation source ID: 00aE0000009pFwx --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 02:02:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936250#M4285</guid>
      <dc:creator>KatieBrander</dc:creator>
      <dc:date>2015-01-08T02:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Possibility to change query layer definition with arcpy (not definition query)</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936251#M4286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there any update on this idea with python 3.x that is shipped with Pro?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2019 20:25:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936251#M4286</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2019-01-11T20:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Possibility to change query layer definition with arcpy (not definition query)</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936252#M4287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;None that I know of.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2019 20:32:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/936252#M4287</guid>
      <dc:creator>KoryKramer</dc:creator>
      <dc:date>2019-01-11T20:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Possibility to change query layer definition with arcpy (not definition query) - Status changed to: In Product Plan</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/1344804#M26791</link>
      <description>&lt;P&gt;A fix was made in Pro 3.2 that enables modifying query layers via Python CIM Access.&amp;nbsp; We will post a sample to this page.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 03:53:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/1344804#M26791</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2023-11-02T03:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: Possibility to change query layer definition with arcpy (not definition query) - Status changed to: Implemented</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/1346981#M26879</link>
      <description>&lt;P&gt;This is possible using ArcGIS Pro version 3.2. In the Updating Data Sources &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/updatingandfixingdatasources.htm#ESRI_SECTION1_DD16BE1F4AC54F078A04C84BD22C8D9B" target="_self"&gt;help topic&lt;/A&gt;, go to the CIM Section, and check out the third code sample:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Reference project, map and layer 
p = arcpy.mp.ArcGISProject(r'C:\Projects\USA.aprx')
m = p.listMaps('USA')[0]
l = m.listLayers('States')[0]

# Get the layer's CIM definition
lyrCIM = l.getDefinition('V3')         

# Update the sql query where clause for the layer
sql = lyrCIM.featureTable.dataConnection.sqlQuery
newsql = sql.replace("WHERE SUB_REGION = 'Mtn'", "WHERE SUB_REGION = 'Pacific'")
lyrCIM.featureTable.dataConnection.sqlQuery = newsql
    
# Set the layer's CIM definition
l.setDefinition(lyrCIM)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above sample changes the sql query, but other properties of the Query Layer can also be updated.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 01:22:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/possibility-to-change-query-layer-definition-with/idc-p/1346981#M26879</guid>
      <dc:creator>JeffMoulds</dc:creator>
      <dc:date>2023-11-08T01:22:46Z</dc:date>
    </item>
  </channel>
</rss>

