使用phoenix sqlline连接hbase。在SecureCRT终端上,我只能看到有超过10列的表的三列。我想显示表的所有列来测试数据是否正确。有什么配置需要设置吗?
0: jdbc:phoenix:10.35.66.72:2181:/hbase> select * from WL.MSGCENTER_PUSHMESSAGE;
+--------------+---------+---------------------------------------------------------------------------------------------------------------------------------------------+
| PLANID | BATCHID | |
+--------------+---------+---------------------------------------------------------------------------------------------------------------------------------------------+
| 520 | 1 | C285995F-AB23-4CF0-A9A4-F29175E9CD36 |
+--------------+---------+---------------------------------------------------------------------------------------------------------------------------------------------+
您可以将输出格式从水平更改为垂直
!outputformat vertical
尝试在启动sqlline
之前设置终端宽度stty cols 200
Sqlline不够智能,无法调整列宽度。把终端放宽一些,你就可以看到数据了。
理想情况下,我会建议您通过use squirrel-sql or db-visualizer
连接到Phoenix。它们是查询凤凰的好工具。
看看这个:http://search-hadoop.com/m/9UY0h2sGBoSz1Mta1
我建议使用Jupyter连接HBase。
我们的团队使用这种方法,我可以很容易地在Juypter中使用水平滚动查看所有列。
下面是我使用的代码片段:import phoenixdb
from sqlalchemy import create_engine
import pandas as pd
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
pd.set_option('display.max_colwidth', None)
def hb_query(x):
conn = phoenixdb.connect(url='http://xxxxx:1234')
with conn.cursor() as cursor:
cursor.execute(x)
data = cursor.fetchall()
des = cursor.description
conn.close()
columns = [i.name.lower() for i in des]
df_tmp = pd.DataFrame(data, columns=columns)
return df_tmp
df = hb_query("""
SELECT *
FROM TABLE_ABCD
""")
df #view rows here
仅供参考,你可能需要先设置Jupyter,我不知道如何设置,也不知道设置是否困难。我的领导很早就建立了这个环境。