2

Is there any way to set multiple location for a table in Amazon Athena? For instance I want to read data from directory 's3://location-1', 's3://location-2', 's3://location-3' etc. Or add them using alter table?

Thanks

Ridwan
  • 301
  • 5
  • 12
  • Athena accepts only single location. So either have a parent directory for all these locations or create multiple tables and then UNION them in query. – Dhaval Aug 02 '17 at 06:25
  • Thanks @Dhaval 10! – Ridwan Aug 02 '17 at 16:37
  • Hope that helped. Cheers :) – Dhaval Aug 03 '17 at 18:44
  • Yea, that was what I was looking for. Would you also please take a look at this questin: https://stackoverflow.com/questions/45490575/query-exhausted-resources-at-this-scale-factor – Ridwan Aug 03 '17 at 20:01

1 Answers1

1

You can actually use partitions for this. Your only limitation is that athena right now only accepts 1 bucket as the source. So using your example, why not create a bucket called "locations", then create sub directories like location-1, location-2, location-3 then apply partitions on it.

That way you can do something like select * from table where location = 'location-1'

See http://docs.aws.amazon.com/athena/latest/ug/partitions.html

Cris
  • 26
  • 2