问题
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 code snippet:
dynamo_client = boto3.resource('dynamodb')
loadeo_loadBoard = dynamo_client.Table('loadeo_bid')
load_id = event['queryStringParameters']['load_id']
company_name = event['queryStringParameters']['companyName']
response = loadeo_loadBoard.scan(
FilterExpression = Attr('posted_by_company').eq(company_name) & Attr('load_id').eq(load_id)
)
#sending to sendResponse function as the response generated by scan will have nested json
return sendResponse(response,company_name)
Here I need to send only the load_id and the bid_amount present in "bid" table, is there a way I can achieve that?
and also is there a way I can achieve joins for my use case?
来源:https://stackoverflow.com/questions/64985504/returning-only-the-subset-for-response-from-dynamdb-scan