Skip to content

Instantly share code, notes, and snippets.

@frankyaorenjie
Last active August 20, 2018 11:44
Show Gist options
  • Save frankyaorenjie/b3a4d2194c4484b7fd17cde47cda6d5d to your computer and use it in GitHub Desktop.
Save frankyaorenjie/b3a4d2194c4484b7fd17cde47cda6d5d to your computer and use it in GitHub Desktop.
[python3 boto for dynamodb] #aws #dynamodb #python
response = dynamodb.batch_get_item(
RequestItems={
'visearch_production_meta': {
'Keys': batch_i_tx_j_list,
'ProjectionExpression': 'm,nd,nk'
}
}
)
dynamodb_results.extend(response['Responses']['visearch_production_meta'])
alias ipy="python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
response = dynamodb.query(
TableName='visearch_production_image',
IndexName='app_id_hash-im_id-index',
KeyConditionExpression='a_h = :a_h',
ExpressionAttributeValues={':a_h': {'S': a_h}},
ProjectionExpression='i,tx_j'
)
i_tx_j_list.extend(response['Items'])
count += response['Count']
while 'LastEvaluatedKey' in response:
response = dynamodb.query(
TableName='visearch_production_image',
IndexName='app_id_hash-im_id-index',
KeyConditionExpression='a_h = :a_h',
ExpressionAttributeValues={':a_h': {'S': a_h}},
ProjectionExpression='i,tx_j',
ExclusiveStartKey=response['LastEvaluatedKey']
)
i_tx_j_list.extend(response['Items'])
count += response['Count']
return i_tx_j_list, count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment