Extract data from HDInsight/Hadoop as Excel/CSV to local machine using Data Lake Tools for ViS

185 views Asked by At

I have been trying to figure out how to extract data from a Hive table within HDInsight (for Windows) to my local machine as an Excel/CSV-file. For this purpose, I am using Data Lake Tools for Visual Studio.

Now I have tried to search for solutions and found this link as well as this link after which I ended up with this query...

INSERT OVERWRITE LOCAL DIRECTORY 'C:\Users\username\Documents' ROW FORMAT DELIMITED FIELDS TERMINATED BY '\;' SELECT * FROM hive_tablec;

When running this query, it actually runs successfully but doesn't show any files in the folder, after it has finished.

I also tried to adjust some of the queries suggested under the first link for my own purposes but this didn't yield any useful results, on the contrary (query here):

SELECT * FROM hive_tablec | sed 's/[\t]/,/g' > 'C:\Users\username\Documents\';

Most of the queries which are upvoted in the first link and apparently work for others, seem written for console interfaces whereas I am using Data Lake Tools. Thus I am looking for a working query for that tool.

So my question is..., does anybody know of a feasible solution to this problem or is able to point out errors in my approach and query?

Thanks in advance for any help.

1

There are 1 answers

1
Pushkr On

There is extra " \" in below statement, which is unnecessary -

FIELDS TERMINATED BY '\;'

just use

FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'