Select to view content in your preferred language

Modify query layer data source using Python

52
0
19 hours ago
Status: Open
Labels (1)
Bud
by
Esteemed Contributor

How to programmatically change the data source for a query layer? from @Map12:

We are trying to change the data sources  for multiple query layers in multiple aprx files. We have run a test script that uses a template aprx and successfully changes the data source through the layer connection properties. However, when opening the new aprx, no data appears.

Once we open the properties for the query layer and make any edits to the query, it then "auto-validates" and data populates. This manual step of editing the query to prompt the query layer to "validate" defeats the purpose of scripting the data source change.

Could Pro be enhanced so that we can modify a query layer’s data source using Python?