0

I am attempting to run all these queries (only part of the 2000 total) and need to export the results from each into their own excel file. Is there a way to automate this with an export function?

select * from Finance.ACCT_LIST limit 1000
select * from Finance.ACCTG_REV_DLY_AGG_F limit 1000
select * from Finance.ACQ_SHIP_F limit 1000
select * from Finance.ACQ_SO_F limit 1000
select * from Finance.ACQUISITION limit 1000
select * from Finance.ACTY limit 1000
select * from Sales.ADDR_CTRY_LANG limit 1000
select * from Common_Dimensions_Finance.ADJ limit 1000
select * from Finance.ADJ_CD_SRC_SYS limit 1000
select * from Common_Dimensions_Finance.ADJ_D limit 1000
select * from Supply_Chain.ADV_SHIP_NOTIF limit 1000
select * from Supply_Chain.ADV_SHIP_NOTIF_ITM limit 1000
select * from Common_Dimensions_Supply_Chain.ADV_SHIP_NOTIF_ITM_D limit 1000

1 Answers1

0

The default output format of Hive query is tsv.
If thats good enough for u then a possible solution is to create a bash script (.sh) as follows:

hive -e "select * from Finance.ACCT_LIST limit 1000" > rs_1.tsv
hive -e "select * from Finance.ACCTG_REV_DLY_AGG_F limit 1000" > rs_2.tsv
hive -e "select * from Finance.ACQ_SHIP_F limit 1000" > rs_3.tsv
hive -e "select * from Finance.ACQ_SO_F limit 1000" > rs_4.tsv
hive -e "select * from Finance.ACQUISITION limit 1000" > rs_5.tsv
hive -e "select * from Finance.ACTY limit 1000" > rs_6.tsv
    .
    .
    .

Then copy all the csv files to your local and open them with Excel.

Otherwise check How do I output the results of a HiveQL query to CSV?

All the above is assuming you can connect to the cluster's master.

Community
  • 1
  • 1
belostoky
  • 934
  • 2
  • 11
  • 22