Select to view content in your preferred language

ArcGIS Pro Python Toolbox - arcpy.ArcSDESQLExecute is not bringing all the results in the query

56
0
Friday
byander
Emerging Contributor

Hello,
I created a Python toolbox (.pyt) and when configuring the parameters, I discovered (on my own since I couldn't find it in the official documentation) that it is possible to list the values ​​through a database query.


Example:

def getParameterInfo(self):
    """Define parameter definitions"""
    param = arcpy.Parameter(
        displayName="Select one option",
        name="id",
        datatype="GPString",
        parameterType="Required",
        direction="Input",
    )

    sql = """
    SELECT
        t.FIELD
    FROM
        TABLE T
    ORDER BY
        t.FIELD;
    """
    conn = arcpy.ArcSDESQLExecute(SDE_FILE)
    values = [row[0] for row in conn.execute(sql)]
    param.filter.list = values

    return [param]

However, some users reported that it is not loading all the data from the table. I was able to verify this and to solve it, I created a new project, added the toolbox and voila, the query brought all the values.

Any solution or is this another bug?

Tags (2)
0 Kudos
0 Replies