I have some issue while formatting a timestamp with Amazon Athena service.
select date_format(current_timestamp, 'y')
Returns just 'y' (the string).
The only way I found to format dates in Amazon Athena is trough CONCAT
+ YEAR
+ MONTH
+ DAY
functions, like this:
select CONCAT(cast(year(current_timestamp) as varchar), '_', cast(day(current_timestamp) as varchar))
We also found Athena to be a robust, powerful, reliable, scalable, and cost-effective ETL tool. The ability to schedule SQL statements, along with support for Create Table As Select (CTAS) and INSERT INTO statements, helped us accelerate our ETL workloads.
Conclusion : Athena can used for complex queries on the files, and span multiple folders under S3 bucket. S3 Select can used for simple queries based in a single object. Show activity on this post. S3 Select makes it easy to retrieve specific data from the contents of an object using simple SQL expressions.
AWS Athena vs AWS Glue A key difference between Glue and Athena is that Athena is primarily used as a query tool for analytics and Glue is more of a transformation and data movement tool. Creating tables for Glue to use in ETL jobs.
Amazon Athena is an interactive query service that makes it easy to analyze data in Amazon S3 using standard SQL. Athena is serverless, so there is no infrastructure to manage, and you pay only for the queries that you run. On the other hand, Presto is detailed as "Distributed SQL Query Engine for Big Data".
select current_timestamp
,date_format (current_timestamp, '%Y_%m_%d')
,format_datetime (current_timestamp, 'y_M_d')
;
+---------------------+------------+-----------+
| _col0 | _col1 | _col2 |
+---------------------+------------+-----------+
| 2017-05-19 14:46:12 | 2017_05_19 | 2017_5_19 |
+---------------------+------------+-----------+
https://prestodb.io/docs/current/functions/datetime.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With