安装依赖pipinstallsaslpipinstallthriftpipinstallthrift-saslpipinstallPyHivepython脚本示例frompyhiveimporthiveHOST="127.0.0.1"PORT=10000USERNAME=="hadoop."ConnectionASENAME="hadoop"DATAB(host=HOST,port=PORT,username=USERNAME,database=DATABASE)cursor=conn.cursor()#cursor.execute("INSERTINTOTABLEtest_out(name,count,time)SELECTname,count(1),to_date(time)FROMtestGROUPBYname,to_date(time)")cursor.execute("SELECT*FROMtest")forresultincursor.fetchall():打印(结果[2])
