ParamValidationError when using DynamoDB paginator
See original GitHub issueI create a DynamoDB paginator like this:
paginator = client.get_paginator('query')
page_iterator = paginator.paginate(
TableName=TABLE_NAME,
IndexName=INDEX_NAME,
KeyConditionExpression=Key('X').eq(x) & Key('Y').lte(y)
)
for page in page_iterator:
print (page['Items'])
return
When I run it, I receive the following error:
Exception has occurred: ParamValidationError
Parameter validation failed:
Invalid type for parameter KeyConditionExpression, value: <boto3.dynamodb.conditions.And object at 0x111524110>, type: <class 'boto3.dynamodb.conditions.And'>, valid types: <class 'str'>
The exact same KeyConditionExpression works when I query the table directly:
result = table.query(
IndexName=INDEX_NAME,
KeyConditionExpression=Key('X').eq(x) & Key('Y').lte(y)
)
BTW: Documentation says that KeyConditionExpression should be a string and not some condition built this way.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Add filter expressions to paginated Boto3 dynamodb scan
I am attempting to filter a paginated scan request to a dynamodb table. While a traditional scan filter would use ...
Read more >DynamoDB — Boto3 Docs 1.26.34 documentation - AWS
With DynamoDB, you can create database tables that can store and retrieve any amount of data, and serve any level of request traffic....
Read more >How to use the botocore.exceptions.ParamValidationError ...
ParamValidationError function in botocore. To help you get started, we've selected a few botocore examples, based on popular ways it is used in...
Read more >Paginating table query results - Amazon DynamoDB
Learn to use pagination when querying Amazon DynamoDB tables. Use paginating when you need the ability to easily page through a query's result...
Read more >Querying against a DynamoDB Primary Key with Boto3
I'm familiar enough with DynamoDB to know (and have experienced) a ... ParamValidationError: Parameter validation failed: Invalid length for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am having the same issue with
KeyConditionExpression
forquery
andpaginator
using
paginator
:getting:
@usegev - We have a customization around resources that converts
KeyConditionExpression
type to string format that’s why you are not getting error when query the table directly.You can use the same format with paginator by using
resource.meta.client
. Something like this:Hope it helps and please let me know if you have any questions.