|
@@ -147,35 +147,36 @@ class MyserviceDynamodb(object):
|
|
def user_brand_all_item_put(self, table_name, data_list):
|
|
def user_brand_all_item_put(self, table_name, data_list):
|
|
dynamodb = self.session.resource('dynamodb')
|
|
dynamodb = self.session.resource('dynamodb')
|
|
table = dynamodb.Table(table_name)
|
|
table = dynamodb.Table(table_name)
|
|
- try:
|
|
|
|
- with table.batch_writer() as batch:
|
|
|
|
- for i in data_list:
|
|
|
|
- data = json.loads(i.decode('utf-8'))
|
|
|
|
- batch.put_item(
|
|
|
|
- Item={
|
|
|
|
- 'userID': data['userID'],
|
|
|
|
- 'addTime': data['addTime'],
|
|
|
|
- 'username': data['username'],
|
|
|
|
- 'deviceSupplier': data['deviceSupplier'],
|
|
|
|
- 'deviceModel': data['deviceModel'],
|
|
|
|
- 'osType': data['osType'],
|
|
|
|
- 'osVersion': data['osVersion'],
|
|
|
|
- 'country': data['country'],
|
|
|
|
- 'province': data['province'],
|
|
|
|
- 'city': data['city'],
|
|
|
|
- 'area': data['area'],
|
|
|
|
- 'street': data['street'],
|
|
|
|
- 'longitude': data['longitude'],
|
|
|
|
- 'latitude': data['latitude'],
|
|
|
|
- 'appId': data['appId'],
|
|
|
|
- 'status_all': data['status_all'],
|
|
|
|
- 'ExpirationTime_TTL': data['ExpirationTime_TTL'],
|
|
|
|
- 'ip': data['ip'],
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
- print('批量添加数据成功!')
|
|
|
|
- except Exception:
|
|
|
|
- logger.error('批量添加表数据失败!')
|
|
|
|
|
|
+ with table.batch_writer() as batch:
|
|
|
|
+ for i in data_list:
|
|
|
|
+ data = json.loads(i.decode('utf-8'))
|
|
|
|
+ batch.put_item(
|
|
|
|
+ Item={
|
|
|
|
+ 'userID': data['userID'],
|
|
|
|
+ 'addTime': data['addTime'],
|
|
|
|
+ 'username': data['username'],
|
|
|
|
+ 'deviceSupplier': data['deviceSupplier'],
|
|
|
|
+ 'deviceModel': data['deviceModel'],
|
|
|
|
+ 'osType': data['osType'],
|
|
|
|
+ 'osVersion': data['osVersion'],
|
|
|
|
+ 'country': data['country'],
|
|
|
|
+ 'province': data['province'],
|
|
|
|
+ 'city': data['city'],
|
|
|
|
+ 'area': data['area'],
|
|
|
|
+ 'street': data['street'],
|
|
|
|
+ 'longitude': data['longitude'],
|
|
|
|
+ 'latitude': data['latitude'],
|
|
|
|
+ 'appId': data['appId'],
|
|
|
|
+ 'status_all': data['status_all'],
|
|
|
|
+ 'ExpirationTime_TTL': data['ExpirationTime_TTL'],
|
|
|
|
+ 'ip': data['ip'],
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ print('批量添加数据成功!')
|
|
|
|
+ # try:
|
|
|
|
+ #
|
|
|
|
+ # except Exception:
|
|
|
|
+ # logger.error('批量添加表数据失败!')
|
|
|
|
|
|
# 添加user_brand表数据
|
|
# 添加user_brand表数据
|
|
def user_brand_item_put(self, table_name, user_id, username, add_time, device_supplier, device_model, os_type,
|
|
def user_brand_item_put(self, table_name, user_id, username, add_time, device_supplier, device_model, os_type,
|