1. 程式人生 > >如何將hive的執行結果返回給一個變數

如何將hive的執行結果返回給一個變數

hive_cmd9 = 'hive -e "select routermac from %s where rank=%s or rank=%s*2 or rank=%s*3 or rank=%s*4 or rank=%s*5 or rank=%s*6 or rank=%s*7 or rank=%s*8 or rank=%s*9 or rank=%s*10 or rank=%s*11 or rank=%s*12 or rank=%s*13 or rank=%s*14 or rank=%s*15 or rank=%s*16 or rank=%s*17 or rank=%s*18 or rank=%s*19 or rank=%s*20 or rank=%s*21 or rank=%s*22 or rank=%s*23 or rank=%s*24 or rank=%s*25 or rank=%s*26 or rank=%s*27 or rank=%s*28 or rank=%s*29 or rank=%s*30 or rank=%s*31 or rank=%s*32 or rank=%s*33 or rank=%s*34 or rank=%s*35 or rank=%s*36 or rank=%s*37 or rank=%s*38 or rank=%s*39;" >> ~/hbase/%s' % (newTableName,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,splitName)

run = os.system(hive_cmd9)