Athena

Athena

LocalStack Pro ships with built-in support for Athena, Amazon’s serverless data warehouse and analytics platform. Athena uses Presto under the covers, and your Athena instance will be automatically configured with a Hive metastore that connects seamlessly to the LocalStack S3 API. That is, you can easily connect your local S3 buckets and query data directly from S3 via the powerful Athena query API.

The following commands illustrate how to use Athena from the command line (assuming you have awslocal installed):

  1. $ awslocal athena start-query-execution --query-string 'SELECT 1, 2, 3'
  2. {
  3. "QueryExecutionId": "c9f453ad"
  4. }
  5. $ awslocal athena list-query-executions
  6. {
  7. "QueryExecutionIds": [
  8. "c9f453ad"
  9. ]
  10. }
  11. $ awslocal athena get-query-results --query-execution-id c9f453ad
  12. {
  13. "ResultSet": {
  14. "Rows": [
  15. {
  16. "Data": [
  17. {
  18. "VarCharValue": "_col0"
  19. },
  20. {
  21. "VarCharValue": "_col1"
  22. },
  23. {
  24. "VarCharValue": "_col2"
  25. }
  26. ]
  27. },
  28. {
  29. "Data": [
  30. {
  31. "VarCharValue": "1"
  32. },
  33. {
  34. "VarCharValue": "2"
  35. },
  36. {
  37. "VarCharValue": "3"
  38. }
  39. ]
  40. }
  41. ],
  42. "ResultSetMetadata": {
  43. "ColumnInfo": [
  44. {
  45. "Name": "_col0",
  46. "Type": "integer"
  47. },
  48. {
  49. "Name": "_col1",
  50. "Type": "integer"
  51. },
  52. {
  53. "Name": "_col2",
  54. "Type": "integer"
  55. }
  56. ]
  57. }
  58. },
  59. "UpdateCount": 0
  60. }

Note: In order to use the Athena API, some additional dependencies have to be fetched from the network, including a Docker image of apprx. 1.5GB which includes Presto, Hive and other tools. These dependencies are automatically fetched when you start up the service, so please make sure you’re on a decent internet connection when pulling the dependencies for the first time.

Last modified June 28, 2022: adjust described athena result (3d3690a0)