-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
good first issueGood item to work on for newcomersGood item to work on for newcomerstype: featureNew feature, or improvement to an existing featureNew feature, or improvement to an existing feature
Description
Hi contributor.
I want get ConsumedCapacity in dynamodb when execute dynamodb.Query.
I think unsupported return ConsumedCapacity in dynamodb.Query .
I want to be supported like to '%s.GetItem' and/or another solution. :)
cf: in my localstrage
@@ -182,6 +188,25 @@ class ProxyListenerDynamoDB(ProxyListener):
if 'StreamSpecification' in data:
create_dynamodb_stream(data)
return
+ elif action == '%s.Query' % ACTION_PREFIX:
+ print('%s.Query')
+ print(response.status_code)
+ if response.status_code == 200:
+ content = json.loads(to_str(response.content))
+ print(content)
+ # make sure we append 'ConsumedCapacity', which is properly
+ # returned by dynalite, but not by AWS's DynamoDBLocal
+ print('ConsumedCapacity')
+ print(content)
+ print(data.get('ReturnConsumedCapacity'))
+ if 'ConsumedCapacity' not in content and data.get('ReturnConsumedCapacity') in ('TOTAL', 'INDEXES'):
+ print('hogehoge')
+ content['ConsumedCapacity'] = {
+ 'CapacityUnits': 0.5, # TODO hardcoded
+ 'TableName': data['TableName']
+ }
+ response._content = json.dumps(content)
+ fix_headers_for_updated_response(response)
else:
# nothing to do
return
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood item to work on for newcomersGood item to work on for newcomerstype: featureNew feature, or improvement to an existing featureNew feature, or improvement to an existing feature