Does SQLAlchemy have any builtin support to execute multiple SELECT 
statements in a single round trip to the database, similar to NHibernate's 
.future() call (http://ayende.com/blog/3979/nhibernate-futures) or 
ActiveRecord::Futures (https://github.com/leoasis/activerecord-futures).

I came across the SQLAlchemy-Future project 
(http://lunant.github.io/SQLAlchemy-Future/), but it appears to just spawn 
a new thread for each query so it doesn't block the normal flow, instead of 
batching multiple queries together into a single trip.

I've seen examples in SQLAlchemy on how to do this for INSERTs, but not for 
SELECT queries.
http://docs.sqlalchemy.org/ru/latest/core/tutorial.html#executing-multiple-statements

If not, it would be nice to call .future() or .promise() on instead of a 
` sqlalchemy.orm.query.Query` instance instead of .all() to batch multiple 
queries and have them executed in a single round trip.  The way NHibernate 
works is it will execute all the queries called with .future() when an 
attempt is made to access the results of one of the query's results.  So if 
you've called .future() on 5 queries, but start to access the results from 
the 3 query before .future() was called on the remaining 2 queries, it will 
make 2 round trips.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to