使用pyhive,可以执行多个hql,比如“CREATE TABLE TABLE1 (ITEM_KEY BIGINT );CREATE TABLE TABLE2 (ITEM_NAME BIGINT );”
示例代码
from pyhive import hive
conn = hive.Connection(host=host
, port=port, username=user
, password=passwd
, auth=auth)
cursor = conn.cursor()
query= 'CREATE TABLE TABLE1 (ITEM_KEY BIGINT );CREATE TABLE TABLE2 (ITEM_NAME BIGINT );'.
cursor.execute(query)发布于 2018-09-04 16:44:29
将查询拆分并逐个执行如何?
qList = query.split(";")
for q in qList:
cursor.execute(q)https://stackoverflow.com/questions/52160361
复制相似问题