def __update_paid_article_info(self, article_content_edit, article_info_table): info_expression_attribute_values = { ':title': article_content_edit['title'], ':eye_catch_url': self.params.get('eye_catch_url'), ':one': 1, ':topic': self.params['topic'], ':tags': TagUtil.get_tags_with_name_collation(self.elasticsearch, self.params.get('tags')), ':price': self.params.get('price') } article_info_table.update_item( Key={ 'article_id': self.params['article_id'], }, UpdateExpression= 'set sync_elasticsearch = :one, topic = :topic, tags = :tags,' ' eye_catch_url=:eye_catch_url, title = :title, price = :price', ExpressionAttributeValues=info_expression_attribute_values)
def __update_paid_article_info(self, article_info_table): info_expression_attribute_values = { ':article_status': 'public', ':one': 1, ':topic': self.params['topic'], ':tags': TagUtil.get_tags_with_name_collation(self.elasticsearch, self.params.get('tags')), ':eye_catch_url': self.params.get('eye_catch_url'), ':price': self.params.get('price') } info_update_expression = 'set #attr = :article_status, sync_elasticsearch = :one, topic = :topic, tags = ' \ ':tags, eye_catch_url=:eye_catch_url, price = :price' article_info_table.update_item( Key={ 'article_id': self.params['article_id'], }, UpdateExpression=info_update_expression, ExpressionAttributeNames={'#attr': 'status'}, ExpressionAttributeValues=info_expression_attribute_values)
def __update_article_info(self, article_content_edit): article_info_table = self.dynamodb.Table( os.environ['ARTICLE_INFO_TABLE_NAME']) article_info_table.update_item( Key={ 'article_id': self.params['article_id'], }, UpdateExpression= ("set title = :title, overview=:overview, eye_catch_url=:eye_catch_url, " "sync_elasticsearch=:sync_elasticsearch, topic=:topic, tags=:tags" ), ExpressionAttributeValues={ ':title': article_content_edit['title'], ':overview': article_content_edit['overview'], ':eye_catch_url': article_content_edit['eye_catch_url'], ':sync_elasticsearch': 1, ':topic': self.params['topic'], ':tags': TagUtil.get_tags_with_name_collation(self.elasticsearch, self.params.get('tags')) })
def __update_article_info(self, article_content_edit, article_info_table): article_info_table.update_item( Key={ 'article_id': self.params['article_id'], }, UpdateExpression= ("set title = :title, eye_catch_url=:eye_catch_url, " "sync_elasticsearch=:sync_elasticsearch, topic=:topic, tags=:tags" ), ExpressionAttributeValues={ ':title': article_content_edit['title'], ':eye_catch_url': self.params.get('eye_catch_url'), ':sync_elasticsearch': 1, ':topic': self.params['topic'], ':tags': TagUtil.get_tags_with_name_collation(self.elasticsearch, self.params.get('tags')) })
def exec_main_proc(self): self.__delete_article_content_edit() self.__create_article_history_and_update_sort_key() article_info_table = self.dynamodb.Table( os.environ['ARTICLE_INFO_TABLE_NAME']) article_info_before = article_info_table.get_item( Key={ 'article_id': self.params['article_id'] }).get('Item') article_info_table.update_item( Key={ 'article_id': self.params['article_id'], }, UpdateExpression= 'set #attr = :article_status, sync_elasticsearch = :one, topic = :topic, tags = :tags', ExpressionAttributeNames={'#attr': 'status'}, ExpressionAttributeValues={ ':article_status': 'public', ':one': 1, ':topic': self.params['topic'], ':tags': TagUtil.get_tags_with_name_collation(self.elasticsearch, self.params.get('tags')) }) try: TagUtil.create_and_count(self.elasticsearch, article_info_before.get('tags'), self.params.get('tags')) except Exception as e: logging.fatal(e) traceback.print_exc() return {'statusCode': 200}