如何从jupyter笔记本中的hdfs中读取大表作为数据帧? 脚本通过docker映像启动
库:
from impala.dbapi import connect
from impala.util import as_pandas
impala_conn = connect(host='hostname', port=21050,
auth_mechanism='GSSAPI',
timeout=100000, use_ssl=True, ca_cert=None,
ldap_user=None, ldap_password=None,
kerberos_service_name='impala')
这很有效
import pandas as pd
df = pd.read_sql("select id, crt_mnemo from demo_db.stg_deals_opn LIMIT 100", impala_conn)
print(df)
这是行不通的。操作挂起,不给出错误
import pandas as pd
df = pd.read_sql("select id, crt_mnemo from demo_db.stg_deals_opn LIMIT 1000", impala_conn)
print(df)
这似乎是使用pandas read_sql函数可以从impala移动的行数的问题。我也有同样的问题,但限制比你的低。您可能需要联系数据库管理员以检查大小。 以下是其他选项:https://docs.cloudera.com/machine-learning/cloud/import-data/topics/ml-running-queries-on-impala-tables.html
相关问题 更多 >
编程相关推荐