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 in AWS by Anjali
• 2,930 points
952 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 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 by Geva

Related Questions In AWS

+1 vote
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 in AWS by athenauserz
1,583 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,090 points
71 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 in AWS by chandan
2,165 views
0 votes
1 answer