【问题标题】:How to write FOR loop in Python Impala?如何在 Python Impala 中编写 FOR 循环?
【发布时间】:2019-12-13 23:11:34
【问题描述】:

我正在尝试编写一个脚本来使用 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 语法是 SHOW TABLES IN DATABASE_NAME HIVE 也是同样的问题。

【问题讨论】:

  • 你不是在执行字符串中缺少?吗?

标签: python sql hive impala


【解决方案1】:
for i in databases.db:
    q1="show tables in "
    q2=q1+i
    cur.execute(q2)  #error occurs here
    output11 = pd.DataFrame(cur.fetchall())

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

【讨论】:

    猜你喜欢
    • 2010-09-08
    • 2022-01-27
    • 1970-01-01
    • 2014-08-16
    • 1970-01-01
    • 1970-01-01
    • 2023-01-01
    • 2019-03-11
    • 1970-01-01
    相关资源
    最近更新 更多