如何在Python Impala中编写FOR循环?

问题描述 投票:0回答:1

我正在尝试编写脚本以使用python列出impala中所有数据库中的所有表。我陷入了for循环部分。

for i in databases.db:
    cur.execute("show tables in", &i)   #error occurs here
    output11 = pd.DataFrame(cur.fetchall())
    print(output11)

由于impala语法为DATABASE_NAME中的SHOW TABLES对HIVE来说也是一样。

python sql hive impala
1个回答
0
投票
for i in databases.db:
    q1="show tables in "
    q2=q1+i
    cur.execute(q2)  #error occurs here
    output11 = pd.DataFrame(cur.fetchall())

我找到了答案。感谢您的观看。

© www.soinside.com 2019 - 2024. All rights reserved.