How to increase expiration of NextToken in DynamoDB ExecuteStatement?

0

We have an API that reads the data from DynamoDB by using PartiQL query in ExecuteStatementWithContext function. This API is paginated and i rely on NextToken for reading all DynamoDB pages.

The problem is that there is an expiry for NextToken and i am getting this error ValidationException: Given NextToken has already expired. Can we increase this expiry in any way?

질문됨 2년 전1231회 조회
1개 답변
1

PartiQL's NextToken has a validity of 1 hour, which the token then expires. There is no way to increase this using the PartiQL API. However, re-writing your code to suit DynamoDB Vanilla API will allow you to retrieve a LastEvaluatedKey which does not expire and may be better suited for your use-case.

profile pictureAWS
전문가
답변함 2년 전
  • Thanks for the answer @Leeroy Hannigan.

    We cannot use Vanilla API because we need to query multiple partition keys in the single query. This is possible currently using PartiQL only.

    It would be of great benefit if LastEvaluatedKey support is present for PartiQL. I can see there is already a question asked couple of months back(https://repost.aws/questions/QUgNPbBYWiRoOlMsJv-XzrWg/how-to-use-last-evaluated-key-in-execute-statement-request). Is there any ETA on this?

  • Using PartiQL as a workaround for a Batch Query is only saving you time on network latency, each Query on the back-end is executed sequentially. So if you use the vanilla API and multi-thread individual Query operations, you will see very little difference in latency and have the advantage of using LastEvaluatedKey.

    On the ETA of LEK being available for PartiQL, we never provide ETA's for any of our feature releases, but you can keep up to date with the newly released features here: https://aws.amazon.com/new/

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠