Posts

Showing posts with the label amazon-dynamodb

DynamoDB and Boto3 error on BatchGetItem operation: “The provided key element does not match the schema”

Image
Clash Royale CLAN TAG #URR8PPP DynamoDB and Boto3 error on BatchGetItem operation: “The provided key element does not match the schema” I am having difficulty with the Boto3/DynamoDB BatchGetItem operation. I would greatly appreciate any help or guidance! I'm pretty new to python/aws so sorry in advanced if this is a novice question. When I perform the operation, I get this error: botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the BatchGetItem operation: The provided key element does not match the schema Here is my code: import boto3 dynamodb = boto3.resource('dynamodb', region_name='us-west-2') response = dynamodb.batch_get_item( RequestItems={ 'test': { 'Keys': [ { 'item_ID': { 'S': '1' } }, { 'item_ID': { ...

Querying DynamoDB GSI with a list of values

Image
Clash Royale CLAN TAG #URR8PPP Querying DynamoDB GSI with a list of values I have a table of "team memberships" with primary partition key of "team_id" , a primary sort key of "email" and a GSI with "email" as partition key. Given a list of emails I would like to find all the memberships for all the emails in the list in the most efficient way possible. I know that for a single email I can do the following: Membership membership = new Membership(); membership.setEmail(email.toLowerCase()); DynamoDBQueryExpression<Membership> expression = new DynamoDBQueryExpression<Membership>() .withHashKeyValues(membership) .withIndexName(EMAIL_INDEX) .withConsistentRead(false); return mapper.query(Membership.class, expression); which returns a list of memberships for the given email. (So for my list of emails, I could do the above for each email in the list, but I would like to know if it is possi...

How to find distance between already saved lat and long and user current lat long in dynamodb aws?

Image
Clash Royale CLAN TAG #URR8PPP How to find distance between already saved lat and long and user current lat long in dynamodb aws? I already have table called location that contains lat and long of hotel and the details, i need query to find the distance between user current location and already saved hotel lat long if less than 25kms show result in dynamoDb, Am new to dynamoDb already i done this with mysql find distance and having used to make that 25kms condition, Thanks in advance. i struggling with this 2 days. 1 Answer 1 No such function exists in DynamoDB. You would need to do the math to calculate the distance between the 2 coordinates yourself By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these pol...