Esempio n. 1
0
 def emit_entity(self, collection, data):
     data['collections'] = [collection]
     entity = Entity.save(data, merge=True)
     db.session.flush()
     update_entity_full.delay(entity.id)
     log.info("Entity [%s]: %s", entity.id, entity.name)
     self.entity_cache[collection.id].append(entity)
     return entity
Esempio n. 2
0
 def emit_entity(self, collection, data):
     data['collections'] = [collection]
     entity = Entity.save(data, merge=True)
     db.session.flush()
     update_entity_full.delay(entity.id)
     log.info("Entity [%s]: %s", entity.id, entity.name)
     self.entity_cache[collection.id].append(entity)
     return entity
Esempio n. 3
0
    def emit_collection(self, collection):
        db.session.commit()
        entities = self.entity_cache.pop(collection.id, [])

        deleted_ids = []
        for entity in collection.entities:
            if entity not in entities:
                entity.delete()
                deleted_ids.append(entity.id)

        db.session.commit()
        for entity_id in deleted_ids:
            update_entity_full.delay(entity_id)
Esempio n. 4
0
    def emit_collection(self, collection):
        db.session.commit()
        entities = self.entity_cache.pop(collection.id, [])

        deleted_ids = []
        for entity in collection.entities:
            if entity not in entities:
                entity.delete()
                deleted_ids.append(entity.id)

        db.session.commit()
        for entity_id in deleted_ids:
            update_entity_full.delay(entity_id)
Esempio n. 5
0
def updateentities():
    """Re-index all the entities."""
    q = db.session.query(Entity.id)
    for (entity_id, ) in q:
        update_entity_full.delay(entity_id)