def _emit_post_update_statements(base_mapper, uowtransaction,
                                 cached_connections, mapper, table, update):

    def update_stmt():
        clause = sql.and_()

        for col in mapper._pks_by_table[table]:
            clause.clauses.append(col == sql.bindparam(col._label,
                                                       type_=col.type))

        return table.update(clause)

    statement = base_mapper._memo(('post_update', table), update_stmt)

    # execute each UPDATE in the order according to the original
    # list of states to guarantee row access order, but
    # also group them into common (connection, cols) sets
    # to support executemany().
    for key, grouper in groupby(
        update, lambda rec: (
            rec[1],  # connection
            set(rec[0])  # parameter keys
        )
    ):
        connection = key[0]
        multiparams = [params for params, conn in grouper]
        cached_connections[connection].\
            execute(statement, multiparams)
Emit UPDATE statements corresponding to value lists collected
dataset/ETHPy150Open zzzeek/sqlalchemy/lib/sqlalchemy/orm/persistence.py/_emit_post_update_statements