Select to view content in your preferred language

MakeQueryLayer doesn't return results in a python script

756
3
Jump to solution
10-26-2023 01:00 PM
AdminRFVL
Occasional Contributor

Hi,

I have an issue using the MakeQueryLayer Geoprocessing tool in a python script. I'm querying a Oracle Spatial DB (Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production). 

When I use the geoprocessing tool from the Data Management Tools (MakeQueryLayer_1.JPG) I get a result. I then "Send to Python Window " to get the python command (MakeQueryLayer_2).JPG). Once again I get a result.

But when I create a python script using the same previous code to run from a ArcGIS Toolbox, the query returns no values. I tried to troubleshoot with a DBA and the conclusion is that when the Query comes from the Python Script, it doesn't reach the database.

What's even weirder is that it only happens when I query a POLYLINE dataset. When I query POINTS or POLYGONS, it works fine.

Any help would be greatly appreciated

Thanks 


0 Kudos
1 Solution

Accepted Solutions
AdminRFVL
Occasional Contributor

I have identified the problem.

The data I'm querying has M-Values and the arcpy.management.MakeQueryLayer within a script doesn't support it.

As a workaround I convert my geom to 2D (SDO_CS.MAKE_2D(c1.GEOM) AS GEOM) since I do not need  the M values in my geoprocessing. 

Could it be a bug ?

 

View solution in original post

0 Kudos
3 Replies
Robert_LeClair
Esri Notable Contributor

So one question I have based upon your 3rd image is the *.sde connection file.  Is the correct *.sde connection file and location?  It could be "blank" so it's therefore not seeing your eGDB.

0 Kudos
AdminRFVL
Occasional Contributor

Hi Robert,

Yes the connection file and location are valid. It's the same connection that was used in the MakeQueryLayer Tool and Python Console and in both cases a result was obtained.

Also, the Python Script works when querying  POLYGON or POINT tables while using the same connection. 

LINESTRING/MULTILINESTRING geometries seem to be the issue. But I don't understand is that they work when using Add Data/Query Layer, MakeQueryLayer Tool but not inside a python script.

Thanks

0 Kudos
AdminRFVL
Occasional Contributor

I have identified the problem.

The data I'm querying has M-Values and the arcpy.management.MakeQueryLayer within a script doesn't support it.

As a workaround I convert my geom to 2D (SDO_CS.MAKE_2D(c1.GEOM) AS GEOM) since I do not need  the M values in my geoprocessing. 

Could it be a bug ?

 

0 Kudos