def insert_comment(parent_id, message): client = datastore.Client() parent_key = client.key('Greeting', int(parent_id)) key = client.key('Comment', parent=parent_key) entity = datastore.Entity(key=key) entity['message'] = message entity["created"] = datetime.now() client.put(entity) entity['id'] = entity.key.id return entity
def insert_descendant(parent_id, web_array): for web in web_array: client = datastore.Client() parent_key = client.key('ScrapingDataSummary', int(parent_id)) key = client.key('ScrapingDataDetails', parent=parent_key) entity = datastore.Entity(key=key) entity['title'] = web[0] entity['users'] = web[1] entity['web_name'] = web[2] entity['url'] = web[3] client.put(entity) return entity
def get_by_id(key_id): client = datastore.Client() key = client.key('TodoList', int(key_id)) entity = client.get(key=key) if entity: entity['id'] = entity.key.id return entity
def get_comments(parent_id): client = datastore.Client() ancestor = client.key('Greeting', int(parent_id)) query = client.query(kind='Comment', ancestor=ancestor) entities = list(query.fetch()) for entity in entities: entity['id'] = entity.key.id return entities
def get_data(parent_id): client = datastore.Client() ancestor = client.key('ScrapingDataSummary', int(parent_id)) query = client.query(kind='ScrapingDataDetails', ancestor=ancestor) entities = list(query.fetch()) for entity in entities: entity['id'] = entity.key.id return entities
def insert(things, check): client = datastore.Client() key = client.key("TodoList") entity = datastore.Entity(key=key) entity["things"] = things entity["check"] = check entity["created"] = datetime.now() client.put(entity) entity['id'] = entity.key.id return entity
def insert(name, pw): client = datastore.Client() key = client.key("Account") entity = datastore.Entity(key=key) entity["name"] = name entity["pw"] = pw entity["created"] = datetime.now() client.put(entity) entity['id'] = entity.key.id return entity
def insert(author, message): client = datastore.Client() key = client.key("Greeting") entity = datastore.Entity(key=key) entity["author"] = author entity["message"] = message entity["created"] = datetime.now() client.put(entity) entity['id'] = entity.key.id return entity
def insert(target, users): client = datastore.Client() key = client.key("ScrapingDataSummary") entity = datastore.Entity(key=key) entity["target"] = target entity["over_num"] = users entity["created"] = datetime.now() client.put(entity) entity['id'] = entity.key.id # 追加した親データのkey_idを返す return entity.key.id
def insert(things, check): client = datastore.Client() key = client.key("Fish") entity = datastore.Entity(key=key) entity["ans0"] entity["ans1"] entity["ans2"] #for i in range(0,10): # entity["word{i}"] = entity["word0"] entity["word1"] entity["word2"] entity["word3"] entity["word4"] entity["word5"] entity["word6"] entity["word7"] entity["word8"] entity["word9"] entity["created"] = datetime.now() client.put(entity) entity['id'] = entity.key.id return entity
def delete(key_id): client = datastore.Client() key = client.key('TodoList', int(key_id)) client.delete(key)
def delete(key_id): client = datastore.Client() key = client.key('Greeting', int(key_id)) client.delete(key)