Skip to content
Advertisement

How to create partitioned table from other tables in Amazon Athena?

I am looking to create a table from an existing table in Amazon Athena. The existing table is partitioned on partition_0, partition_1, and partition_2 (all strings) and I would like this partition to carry over. Here is my code:

Trying to run this gives me an error at the FROM line, saying "mismatched input 'by'. expecting: '(', ',',"…. Status code: 400; error code:invalidrequestexception
Not sure what syntax I am missing here.

Advertisement

Answer

This is the syntax for creating new tables:

See the documentation for more examples: https://docs.aws.amazon.com/athena/latest/ug/ctas-examples.html#ctas-example-partitioned

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement