The heavyai client interface provides a Python DB API 2.0-compliant HEAVY.AI interface. In addition, it provides methods to get results in the Apache Arrow-based GDF format for efficient data interchange.
>>> con = connect(user="heavyai", password="HyperInteractive", host="my.host.com", dbname="heavyai")
Copied!
Step 2: Create a cursor
1
>>> c = con.cursor()
2
>>> c
Copied!
Step 3: Query database table of flight departure and arrival delay times
1
>>> c.execute("SELECT depdelay, arrdelay FROM flights LIMIT 100")
Copied!
Step 4: Display number of rows returned
1
>>> c.rowcount
2
100
Copied!
Step 5: Display the Description objects list
The list is a named tuple with attributes required by the specification. There is one entry per returned column, and we fill the name, type_code, and null_ok attributes.