amazon-dynamodb

DynamoDB with boto3 - limit acts as page size

旧城冷巷雨未停 提交于 2020-12-15 06:19:17
问题 According to the boto3 docs, the limit argument in query allows you to to limit the number of evaluated objects in your DynamoDB table/GSI. However, LastEvaluatedKey isn't returned when the desired limit is reached and therefore a client that would like to limit the number of fetched results will fail to do so consider the following code: while True: query_result = self._dynamodb_client.query(**query_kwargs) for dynamodb_formatted_item in query_result["Items"]: yield self._convert_dict_from

DynamoDB with boto3 - limit acts as page size

妖精的绣舞 提交于 2020-12-15 06:19:10
问题 According to the boto3 docs, the limit argument in query allows you to to limit the number of evaluated objects in your DynamoDB table/GSI. However, LastEvaluatedKey isn't returned when the desired limit is reached and therefore a client that would like to limit the number of fetched results will fail to do so consider the following code: while True: query_result = self._dynamodb_client.query(**query_kwargs) for dynamodb_formatted_item in query_result["Items"]: yield self._convert_dict_from

Including headers and data array in Return Statement with Node.js

白昼怎懂夜的黑 提交于 2020-12-15 01:48:32
问题 I have a lambda function that gets all items in a dynamoDB table as seen below. I am wondering if there is a way to include the response headers as well as the "scanResults" array in the return statement. In my current code I can either include the headers or the scanResults array. I have tried putting two return statements but that is incorrect code. Is there a way to combine them? Thanks in advance for any help. 'use strict'; const AWS = require('aws-sdk'); exports.handler = async (event,

Including headers and data array in Return Statement with Node.js

孤街醉人 提交于 2020-12-15 01:43:11
问题 I have a lambda function that gets all items in a dynamoDB table as seen below. I am wondering if there is a way to include the response headers as well as the "scanResults" array in the return statement. In my current code I can either include the headers or the scanResults array. I have tried putting two return statements but that is incorrect code. Is there a way to combine them? Thanks in advance for any help. 'use strict'; const AWS = require('aws-sdk'); exports.handler = async (event,

How to loop extract element from dynamodb recursively

家住魔仙堡 提交于 2020-12-15 01:41:06
问题 1 I am trying to extract element from dynamdb recurselvely 2 I have dynamodb table with below attributes `id, masterId, masterName` 3 I need to go to each id in the dynamodb check whether 'masterId' != '' and 'masterName' != 'Reserved' 4 if 3rd one got success then I need to extract ``'masterId' and 'masterName' to totallist ` ** Now pass masterId to same function as id this will keep on running till 'masterId' == '' and 'masterName' == 'Reserved' else: add to newlist_dict Basically for the

dynamodb: how to increment a value in map

点点圈 提交于 2020-12-14 12:39:28
问题 I am trying to use dynamodb to maintain a map of names with their values eg. {"scores": {"player-a": 10}} I also wish to use increment operator to perform atomic increments. However, i could find very little documentation on how to use/update dynamodb maps. Here's the python code I have so far import boto3 ddb = boto3.client('dynamodb') ddb.update_item(TableName='ledger', Key={'week': {'S': '06-12'}}, UpdateExpression='SET scores.player-a = scores.player-a + :val', ExpressionAttributeValues={

dynamodb: how to increment a value in map

痞子三分冷 提交于 2020-12-14 12:33:26
问题 I am trying to use dynamodb to maintain a map of names with their values eg. {"scores": {"player-a": 10}} I also wish to use increment operator to perform atomic increments. However, i could find very little documentation on how to use/update dynamodb maps. Here's the python code I have so far import boto3 ddb = boto3.client('dynamodb') ddb.update_item(TableName='ledger', Key={'week': {'S': '06-12'}}, UpdateExpression='SET scores.player-a = scores.player-a + :val', ExpressionAttributeValues={

DynamoDb UpdateItem runs twice

只愿长相守 提交于 2020-12-13 03:40:36
问题 When I update an item via update (updateItem) then the update function is called twice and my value will be added two times. I use async/await and it should work. var ddb = new AWS.DynamoDB.DocumentClient({ apiVersion: '2012-08-10' }); async function updateUserGame(tablePostfix, gameId, durationinMin) { console.log("###### updateUserGame") var tableUserGames = tableUserGamesWithoutPostfix + tablePostfix; expressions = { ":duration": parseInt(durationinMin) } updateExpressions = "set

DynamoDb UpdateItem runs twice

℡╲_俬逩灬. 提交于 2020-12-13 03:38:17
问题 When I update an item via update (updateItem) then the update function is called twice and my value will be added two times. I use async/await and it should work. var ddb = new AWS.DynamoDB.DocumentClient({ apiVersion: '2012-08-10' }); async function updateUserGame(tablePostfix, gameId, durationinMin) { console.log("###### updateUserGame") var tableUserGames = tableUserGamesWithoutPostfix + tablePostfix; expressions = { ":duration": parseInt(durationinMin) } updateExpressions = "set

Returning only the subset for response from dynamdb scan

做~自己de王妃 提交于 2020-12-13 03:28:20
问题 the use case that I am trying to achieve is: To check if there is any existing bid on the load that has been posted. there 2 different tables "load" which has information on the load "bid" which has information of bid on loads. Now I read that dynamodb can't support joins as RDS does. How can I check there is an exiting bid on a load? My approach here was to scan the "bid" table with load_id and bid_by and send the information to the front end and do the rest of the operation there. here is a