Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Athena query returns results in incorrect format when query is run again

The first time I ran the query, it returned 2 rows with columns names. I edited the table and added skip.header.line.count - 1 and reran(First time), but it returned same result with double inverted commas. Then reran again(Second time), and this changed everything.

First time Query run output: https://i.sstatic.net/k6T2O.png

Second time Query run output: https://i.sstatic.net/6Cxrf.png

like image 886
Atul Avatar asked Nov 01 '25 09:11

Atul


1 Answers

The problem is that output files from Amazon Athena are being mixed-in with your source files.

To fix it, go to the Athena console and click Settings.

Then, change the Query result location to a different location that does not point to the location where you are storing the source data files.

The Query result location is where Athena stores the output of queries, in case you need the results again or want to use them as input to future queries.

like image 161
John Rotenstein Avatar answered Nov 02 '25 22:11

John Rotenstein



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!