athena-express icon indicating copy to clipboard operation
athena-express copied to clipboard

Empty response when using pagination

Open camilinha opened this issue 2 years ago • 2 comments

Hi, I ran into an unexpected situation using pagination parameter.

The queries where I use pagination parameter sometimes return with an empty response. But if I run the same query on AWS console, there are results. The S3 file also has the correct response, but the library says otherwise.

If I take out the pagination parameter this problem never happens. But the case is that I have a query with many results, so I need to use the pagination.

Anyone has the same problem? Is there a solution for this?

Thanks!

camilinha avatar Oct 29 '21 14:10 camilinha

I was experiencing it too. What I think is happening is that the previous query/pagination is cached somehow between runs so when you have run through all the results you get empty results every query afterwards.

I'm running it in a lambda and a workaround that I found that fixed it was moving the initialization to inside the exports.handler like this

"use strict";

const AthenaExpress = require("athena-express");
const AWS = require("aws-sdk");

exports.handler = async (event) => {
    const athenaExpressConfig = {
    	aws: AWS,
    };
    const athenaExpress = new AthenaExpress(athenaExpressConfig);
...

ledoux7 avatar Nov 13 '21 22:11 ledoux7

Pushed a new version on NPM. Give this one a try please.

ghdna avatar Jan 17 '22 16:01 ghdna