Accessing query results

After querying the 1010data Insights Platform, your application receives a set of results, which is accessible through the Query object.

After the query is run, the Query object is the results of the query. Your results are a set of Column objects. Column objects contain the values in the column as a list that can be iterated over and indexed.

This example uses the row iterator exampleQuery.rows to print each row in the results. You can access an individual row by specifying an index (e.g., exampleQuery.rows[100]).

import py1010
import sys

gateway = ""
tablename = ""
username = "[USER_NAME]"
password = "[PASSWORD]"

testSession = py1010.Session(gateway, username, password, py1010.POSSESS)
exampleQuery = testSession.query(tablename, '<sel value="(elev>10)"/>')
for r in exampleQuery.rows:
    print("\t".join([str(x) for x in r]))
Note: [USER_NAME] and [PASSWORD] are placeholders for valid Insights Platform user name and password.