2 Answers
- Newest
- Most votes
- Most comments
0
Hello , concerning the usage of WITH + UNLOAD this way :
WITH tmp_tble AS ()
UNLOAD (SELECT * FROM tmp_tble)
....
This syntax doesnt work , also its not mentioned in both official Athena syntax documentations here, so this is a confirmation , if it was possible they would have add it to the UNLOAD syntax doc at least , but its not
https://docs.aws.amazon.com/athena/latest/ug/unload.html https://docs.aws.amazon.com/athena/latest/ug/select.html
answered 3 months ago
-2
Hello,
The below Athena UNLOAD query with the WITH clause worked fine for me.
UNLOAD(select * from table)
to 's3://bucket/'
with(format='parquet',compression='snappy')
You can find some examples here
Relevant content
- asked 2 years ago
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 2 years ago
Thanks for your answer, but I mean the "classic" SQL WITH clause (for aliasing whole queries), not the with clause for adding the UNLOAD options.
Something like:
WITH table1 as (SELECT raw.field1, raw.field2, raw2.field1, raw2.field1 from raw, raw2 ....), table2 as (SELECT raw3.field1, raw3.field2, raw3.field3 from raw3) UNLOAD (SELECT * from table1, table2 ....) to 's3://bucket/' with(format='parquet',compression='snappy')