def set_cte(self, cte_id, sql):
        """This is the equivalent of what self.extra_ctes[cte_id] = sql would
        do if extra_ctes were an OrderedDict
        """
        for cte in self.extra_ctes:
            if cte['id'] == cte_id:
                cte['sql'] = sql
                break
        else:
            self.extra_ctes.append(
                {'id': cte_id, 'sql': sql}
            )