I'd like to be able to manage my own connections and transactions with sqlalchemy:

def foo(connection):
    pd.read_sql_query(query, con=connection)

def bar(connection, data):
    data.to_sql(name='foo', con=connection)

def main():
    with engine.connection() as conn, conn.begin():
        bar(foo(), connection=conn)
        bar(some_other_data, connection=conn)

Comment From: jorisvandenbossche

See #7877. So closing this as a duplicate (but certainly comment there! or at the PR at once)