def run()

in cartography/driftdetect/model.py [0:0]


    def run(self, session, update):
        """
        Performs Detection
        :type session: neo4j session
        :param session: Graph session to pull infrastructure information from
        :type update: boolean
        :param update: Decides whether or not to update the graph
        :return: iterable of dictionaries of drift information
        """

        results = session.run(self.validation_query)
        logger.debug("Running validation for {0}".format(self.name))

        for record in results:
            values = []
            for field in record.values():
                if not field:
                    values.append("")
                elif isinstance(field, list):
                    s = "|".join(field)
                    values.append(s)
                else:
                    values.append(field)
            if values not in self.expectations:
                if update:
                    self.expectations.append(values)
                yield _build_drift_insight(record)