wrt basic behaviour, this library seems to save all of two lines which can easily be bundled in a convenience function:<p><pre><code>    def query(connection, q):
        cursor = connection.cursor(cursor_factory=psycopg2.extras.DictCursor)
        cursor.execute(q)
        return iter(cursor.fetchone, None)

    # db = records.Database(&#x27;postgres:&#x2F;&#x2F;...&#x27;)
    db = psycopg2.connect(&#x27;postgres:&#x2F;&#x2F;...&#x27;)
    # rows = db.query(&#x27;select * from active_users&#x27;)
    rows = query(db, &#x27;select * from active_users&#x27;)
    # rows.next()
    next(rows)
    # for row in rows:
    #    spam_user(name=row[&#x27;name&#x27;], email=row[&#x27;user_email&#x27;])
    for row in rows:
        spam_user(name=row[&#x27;name&#x27;], email=row[&#x27;user_email&#x27;])
    # rows.all()
    list(rows)</code></pre>