arcPy on query layer

1714
4
10-07-2011 04:54 AM
SteveLi
New Contributor
I need to make many MXDs which include query layers (NOT through layer definition).  The difference of these MXDs is only the query of the layer.  Is there way to automate this?

Thanks.
0 Kudos
4 Replies
RussellBrennan
Esri Contributor
Hi Steve,

There is currently no option to create or alter query layers through Python at 9.x or 10.

If you have access to the Beta program you can take a look at the "Make Query Layer" tool in 10.1 Beta.
0 Kudos
MichaelVolz
Esteemed Contributor
I see the Make Query Layer in the Data Management->Layers and Table Views Toolbox which is great.

I would also like to know if there is the ability to edit a Query Layer, that is already created, through python.  In my scenario, I see many Query Layers created with an Oracle 11g Client connection.  If the back end database gets updated to Oracle 12c (which my organization will probably do within the next 2 years), I would want to update the Query Layer to use the Oracle 12c Client connection instead of the Oracle 11g Client connection.  Is this scenario currently possible through python?
0 Kudos
RonnieRichards
Regular Contributor

Is it even possible to detect a if a layer is a query layer using ArcPy?

0 Kudos
BillDaigle
Occasional Contributor III

Only way I know is to do a describe on the layer and look for the string "%" in the datasetName property. 

0 Kudos