How to store Amazon Athena Query Results into new Table

0 votes
I need to store Amazon Athena query results into New Amazon Athena Table. Can someone help me with this?
Jan 16, 2019 in AWS by Anjali
• 2,950 points
4,098 views

2 answers to this question.

0 votes

This is not supported by Athena as Amazon Athena does not support INSERT or CTAS (Create Table As Select) queries.

Amazon athena stores query result in S3. Here is a documentation on how Athena works. https://docs.aws.amazon.com/athena/latest/ug/querying.html

As Athena only points to data in S3. So once results are in S3, you can use athena to point to this as a new table.

answered Jan 16, 2019 by heena
0 votes

You can use CTAS - as Amazon Athena support it :

for example :

CREATE TABLE new_table
WITH (
      format = 'Parquet',
      parquet_compression = 'SNAPPY')
AS SELECT *
FROM old_table

Amazon Athena DO support CTAS:

https://docs.aws.amazon.com/athena/latest/ug/create-table-as.html

answered Aug 6, 2019 by Geva

Related Questions In AWS

+1 vote
1 answer
+2 votes
1 answer
0 votes
2 answers

How to skip headers when reading a CSV file in S3 and creating a table in AWS Athena?

Thanks for the answer. This should be clear ...READ MORE

answered Aug 14, 2019 in AWS by athenauserz
11,232 views
0 votes
1 answer

How to upload an object into Amazon S3 in Lambda?

I suspect you are calling the context.done() function before s3.upload() has ...READ MORE

answered Sep 27, 2018 in AWS by Archana
• 4,170 points
950 views
0 votes
1 answer
+1 vote
2 answers
0 votes
1 answer

How to convert String to Date in Amazon Athena?

You can use date_parse. All you need ...READ MORE

answered Jan 16, 2019 in AWS by chandan
26,340 views
0 votes
1 answer

How to load data into a table in DynamoDB using Java?

You can create a .json file with the ...READ MORE

answered Feb 26, 2019 in AWS by Priyaj
• 58,090 points
6,505 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP