ghdna / athena-express

Athena-Express can simplify executing SQL queries in Amazon Athena AND fetching cleaned-up JSON results in the same synchronous or asynchronous request - well suited for web applications.
https://www.npmjs.com/package/athena-express
MIT License
179 stars 70 forks source link

Extend type support for dates and timestamps #67

Open ssedano opened 2 years ago

ssedano commented 2 years ago

Optionally (defaults to false) cast date, timestamp, and timestamp with time zone data types to JS Date objects. Query method doesn't expose the data type forcing developers that want to operate with Date objects to track which columns are dates and perform the cast themselves.

Dates and timestamps are casted to JS Date types using Luxon library. The code uses the method to transform SQL formats, consistent with Presto/Trino documentation.

The code uses Luxon, and as such, it requires ICU full extension to work. ICU full mode is available by default starting on Node v13, but needs to be configured for previous versions of Node.

Resolves #49

ssedano commented 2 years ago

@ghdna Any chance I can get this reviewed, please? Thank you!

ghdna commented 2 years ago

Yes, will check it out this weekend.

ssedano commented 2 years ago

Included the dependencies in package-lock.json (all are scoped to development)

ssedano commented 2 years ago

Gentle reminder

ghdna commented 2 years ago

Can we do this without adding another library as dependency? It increases maintenance down the road.