def iteritems(self, prefix=None):
        """Like dict.iteritems."""
        query = Setting.query
        if prefix:
            query = query.filter(Setting.key.startswith(prefix))

        for s in query.yield_per(1000):
            yield (s.key, s.value)
Like dict.iteritems.