python - AttributeError: 'Table' object has no attribute 'update_item' - DynamoDB v2 API -
i trying conditionally update item in dynamodb using following code:
from boto.dynamodb2.table import table conn = get_layer1_ddb_connection() values_table = table(table_name, connection=conn) attrs = { 'values' : new_values, 'version' : existing_item['version'] + 1} condition_expression = 'version = :v' values_table.update_item(table_name, key=customer_id, attribute_updates=attrs, condition_expression=condition_expression, expression_attribute_values={':v': existing_item['version'],}, return_values='all_old',)
where, layer1 connection created this:
from boto.dynamodb2.layer1 import dynamodbconnection def get_layer1_ddb_connection(self): return dynamodbconnection(region=self.region, aws_access_key_id=self.creds[cred_access_key], aws_secret_access_key=self.creds[cred_secret_key])
self.region
of type regioninfo , self.creds have worked other high level api calls.
if i'm not mistaken, may hint in source of table.py. inside private _update_item()
method, calls conn.update_item
.
self.connection.update_item(self.table_name, raw_key, item_data, **kwargs)
so perhaps try calling update_item()
on connection instead of table , see if helps.
Comments
Post a Comment