Make query layer returns 0 records, both from toolbox and arcpy.

64
2
10-18-2019 04:43 PM
Highlighted
New Contributor III

Is this a known issue? The same exact code works in ArcMap 10.7.1 toolbox and arcpy.

Reply
0 Kudos
2 Replies
Highlighted
MVP Esteemed Contributor

What you describe would be a huge issue if it broadly applied to ArcGIS Pro, so I am guessing it is something specific to your data sets or parameters.  Can you provide some more specifics on what data sources are involved and the syntax you are using to call/use the tool?

Reply
0 Kudos
Highlighted
New Contributor III

Looks like in the ArcPro version, there is an additional parameter called spatial_properties, that wasn't in the ArcMap version.

Setting this property seems to resolve my issue, e.g:

arcpy.MakeQueryLayer_management(
    my_db_conn,
    'layer',
    'select * from my_table',

    oid_fields='objectid',
    spatial_properties='DO_NOT_DEFINE_SPATIAL_PROPERTIES'
)

I guess in ArcMap the default behavior was to not provide spatial properties whereas in ArcPro the default behavior assumes you will provide them.

Reply
0 Kudos