Python - Phoenixdb 没有返回带有值的列名,而是返回值列表(行)
Python - Phoenixdb is not returning column name with value instead it is returning list of values (row)
我正在使用 python 中的 phoenixdb 库从 hbase 中获取数据,然后在 运行ning sql 查询之后,数据返回行值列表。
例如:
当我 运行 以下查询时。
cursor.execute("Select * from user")
cursor.fetchall()
正在显示结果
[abc@any.com, 9876543120, 26, 12-12-1976]
而不是字典或关联数组之类的东西,这样我们就可以知道键和值,即列名及其值
[email=>abc@any.com, phone=>9876543120, age=>26, dob=>12-12-1976]
如果你想要字典结构中的结果,在创建游标时设置游标Factory:
cursor = conn.cursor(cursor_factory=phoenixdb.cursor.DictCursor)
我正在使用 python 中的 phoenixdb 库从 hbase 中获取数据,然后在 运行ning sql 查询之后,数据返回行值列表。
例如: 当我 运行 以下查询时。
cursor.execute("Select * from user")
cursor.fetchall()
正在显示结果
[abc@any.com, 9876543120, 26, 12-12-1976]
而不是字典或关联数组之类的东西,这样我们就可以知道键和值,即列名及其值
[email=>abc@any.com, phone=>9876543120, age=>26, dob=>12-12-1976]
如果你想要字典结构中的结果,在创建游标时设置游标Factory:
cursor = conn.cursor(cursor_factory=phoenixdb.cursor.DictCursor)