Re: [Twisted-Python] yielding from within deferToThread

2015-12-03 Thread Naveen Michaud-Agrawal
To answer my own question, it looks like i can just pass sqlalchemy's ResultProxy into deferToThread to make a blocking call to fetch the next set of results: @defer.inlineCallbacks def stream_results(): engine = sqlalchemy.create_engine(...) query = "select * from table" proxy = yield

[Twisted-Python] yielding from within deferToThread

2015-12-03 Thread Naveen Michaud-Agrawal
I'm trying to use sqlalchemy from a twisted application (by running all blocking queries using deferToThread). Is it possible to yield from within the function running in deferToThread? For example: def threadRunQuery(engine, query): conn = engine.connect() res = conn.execute(query)