0

我试图使用 Impyla 从 Impala 中提取数据。将数据放在 DataFrame 中会很好。下面是一个应该拉几千行的示例查询,但是,当我运行它时,我会返回一个空的 DataFrame ...处理更多数据?

from impala.dbapi import connect
from impala.util import as_pandas

def execute_query(query):
  try:
    impala_con = connect(host='host',
                         port=port, 
                         auth_mechanism='PLAIN')

    impala_cur = impala_con.cursor()
    impala_cur.execute(query)
    res = as_pandas(impala_cur)
    impala_cur.close()
    impala_con.close()
    return res
  except Exception as err:
    return err
    
query = "SELECT tb.date, tb.id, tb.source \
FROM db.tbl AS tb \
WHERE journal_date >= '2021-08-25 00:00:00.000'"

df = execute_query(query)
4

0 回答 0