Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadMe -- Query PartitionKey using begins_with? #105

Open
whieronymus opened this issue Oct 23, 2020 · 1 comment
Open

ReadMe -- Query PartitionKey using begins_with? #105

whieronymus opened this issue Oct 23, 2020 · 1 comment

Comments

@whieronymus
Copy link

In your example on the Readme:

# Query based on the keys
Book.query(isbn__begins_with="12345")

As far as I know, you cannot use a query on a DyanmoDB table without using an exact match on Partition(Hash) Key.
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
How are you using isbn__begins_with="12345" here?

I tried a similar example locally and I get the following Boto3 error:
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the Query operation: Query key condition not supported

Is this a bug? If not, why does it work?

@alissonpelizaro
Copy link

For querys is mandatory use the full hash key, because it uses indexed values to get a data. This is a DynamoDB requirement.
You can do this using scan instead without any problems, but remember that this one need more processing because it desconsider key <=> value indexement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants