support sqlalchemy connections (original) (raw)

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)