def select_each(conn, query: str, parameter_groups, name=None):
    """Run select query for each parameter set in single transaction."""

    with conn:
        with conn.cursor(name=name) as cursor:
            for parameters in parameter_groups:
                cursor.execute(query, parameters)
                yield cursor.fetchone()