def has_cycles(self, relation=None, visited=None):
        if visited is None:
            visited = list()

        if relation:
            # Don't include table as own dependency, ignore references not in DB
            relations_to_check = [
                self.relation(x) for x in relation.dependencies
                if x != relation and self.relation(x) is not None]
        else:
            relations_to_check = self._relations.values()

        for relation in relations_to_check:
            if relation.full_name in visited:
                return True
            # Make a copy for immutability
            visited_copy = deepcopy(visited)
            visited_copy.append(relation.full_name)
            if self.has_cycles(relation, visited_copy):
                return True
        return False
Check if the database has no circular dependencies
dataset/ETHPy150Open coursera/dataduct/dataduct/database/database.py/Database.has_cycles