Search code examples
python-3.xhbaseapache-phoenix

Python - Phoenixdb is not returning column name with value instead it is returning list of values (row)


i am using phoenixdb library in python to fetch data from hbase, then after running sql queries, data is returning list of row values.

For example: when i run the following query.

cursor.execute("Select * from user")
cursor.fetchall()

result is showing

[[email protected], 9876543120, 26, 12-12-1976]

instead of something like dictionary or associated array so that we can know key and value i.e., column name and its value

[email=>[email protected], phone=>9876543120, age=>26, dob=>12-12-1976]

Solution

  • If you want the results in the dictonary structure, set the cursorFactory while creating the cursor:

    cursor = conn.cursor(cursor_factory=phoenixdb.cursor.DictCursor)