'Executes the given SQL query string and returns an iterator of rows.
With first=True, returns the first row.'

def execute(self, sql, values=(), first=False, commit=True):

    try:
        r = self._connection.cursor().execute(sql, values)
        if commit:
            self._connection.commit()
    except Exception as e:
        self._connection.rollback()
        raise DatabaseError(str(e))
    return (r.fetchone() if first else r)
