AnsweredAssumed Answered

Can't get reference to result from MakeQueryLayer_management

Question asked by tim.haverland_noaa on Oct 10, 2012
Latest reply on Nov 18, 2016 by dpettittva
When I try to run arcpy.MakeQueryLayer_management from the python command window, I can't get the resulting table added to the ArcMap display.

For example (I've changed the details to a generic case):

>>> arcpy.MakeQueryLayer_management('Database Connections\my_database.sde','a_table_view','select a_field from some_table','a_field')


The database I'm querying is Oracle 11g.

The command runs successfully (python returns <Result 'a_table_view'>, but when I go to the arctoolbox results tab, rt-click on the output, and choose Add to display I don't get anything. Likewise I can't seem to find this table through the various listing methods:

>>> mxd = arcpy.mapping.MapDocument("CURRENT") >>> df = mxd.activeDataFrame >>> arcpy.mapping.ListLayers(mxd,data_frame=df) [] >>> arcpy.mapping.ListTableViews(mxd,data_frame=df) [] >>> 


I've also tried getting a reference from:
arcpy.mapping.TableView('a_table_view')


and get an Assertion error.

Any ideas?

Thanks,

Tim

Outcomes