0

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.

Community
  • 1
  • 1
themightyhulk
  • 175
  • 1
  • 1
  • 11

1 Answers1

0

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

FIELDS TERMINATED BY '\;'

just use

FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
Pushkr
  • 3,591
  • 18
  • 31
  • Thank you for your help. I tried your suggestion but this resulted in a "Failed" execution of the query. I subsequently ran the query I stated in my first post which again "Finished" but didn't create the file on local machine. So, I still am looking for a viable solution to this problem. If anybody has some input, please do tell. Thanks. – themightyhulk Dec 22 '16 at 16:40