py 之impala数据库连接
from impala.dbapi import connect conn = connect(host='127.0.0.1', port=21050) cur = conn.cursor() sql_cmd = 'select name from data.user_data where envi_name = \'{}\' and \ create_time between \'{}\' and \'{}\' and platform_name = \'{}\' '.format(even_name, start_time, end_time, producet_name) print('sql_cmd: ', sql_cmd) cur.execute(sql_cmd) data_list = cur.fetchall() login_count = len(data_list)