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

Result reuse feature addition #98

Open buseta77 opened 1 month ago

buseta77 commented 1 month ago

Having used this library a lot, I decided to create a PR regarding a feature and an issue that helped me most.

  1. The feature I added is the built-in "Result Reuse" feature that Athena provides in the management console. By enabling "reuse" config I added, you can use previously cached result up to 7 days, which helps so much with execution times.
  2. Second one is a bug I encountered: while library is gathering streamed data from Athena, if there are some weird characters in the data and somehow it leads to incorrect data types, then addDataType function hangs forever and not responding. By simply adding a try-catch block, it returns data as expected and makes the incorrect data null so that it can be handled in the app logic.