def insert_values(engine, table_, values):
    '\n            Inserts a row into a table, returns the full list of values\n            INSERTed including defaults that fired off on the DB side and\n            detects rows that had defaults and post-fetches.\n            '
    if engine.dialect.implicit_returning:
        ins = table_.insert()
        comp = ins.compile(engine, column_keys=list(values))
        if (not set(values).issuperset((c.key for c in table_.primary_key))):
            is_(bool(comp.returning), True)
    result = engine.execute(table_.insert(), **values)
    ret = values.copy()
    for (col, id_) in zip(table_.primary_key, result.inserted_primary_key):
        ret[col.key] = id_
    if result.lastrow_has_defaults():
        criterion = and_(*[(col == id_) for (col, id_) in zip(table_.primary_key, result.inserted_primary_key)])
        row = engine.execute(table_.select(criterion)).first()
        for c in table_.c:
            ret[c.key] = row[c]
    return ret
Inserts a row into a table, returns the full list of values
INSERTed including defaults that fired off on the DB side and
detects rows that had defaults and post-fetches.
def insert_values(engine, table_, values):
    '\n            Inserts a row into a table, returns the full list of values\n            INSERTed including defaults that fired off on the DB side and\n            detects rows that had defaults and post-fetches.\n            '
    if engine.dialect.implicit_returning:
        ins = table_.insert()
        comp = ins.compile(engine, column_keys=list(values))
        if (not set(values).issuperset((c.key for c in table_.primary_key))):
            is_(bool(comp.returning), True)
    result = engine.execute(table_.insert(), **values)
    ret = values.copy()
    for (col, id_) in zip(table_.primary_key, result.inserted_primary_key):
        ret[col.key] = id_
    if result.lastrow_has_defaults():
        criterion = and_(*[(col == id_) for (col, id_) in zip(table_.primary_key, result.inserted_primary_key)])
        row = engine.execute(table_.select(criterion)).first()
        for c in table_.c:
            ret[c.key] = row[c]
    return ret