Michael Bayer wrote:
On Apr 6, 2006, at 3:41 PM, dmiller wrote:
Does this mean I don't need to use mapper.using(...).select(...) to
execute a query on a session anymore? i.e. I could do
mapper.select(session=x, ...)
oh...well, I actually just committed "the big change", since after
looking at the problem I could see numerous advantages to the Query
object you proposed, including that the whole concept of "selecting"
could be moved from the mapper module into its own module, since its a
different kind of "lifting" than what the rest of Mapper does, and also
the using() function is now a nice reasonable method that returns a new
Query with the given session stored inside of it.
Excellent! Now if we could just get everyone to use Query to issue their SQL
statements, then we could totally abstract the thread-local Session pattern to
ThreadLocalQuery, which would get it's session from a session registry rather
than having it provided as a constructor arg.
so I took the "session" keyword argument out for this revision....we can
put it in but the thing I dont like about it is that most of the "query"
methods dont have the room for arbitrary keyword arguments, such as
select_by, get_by, count_by, select_statement, where the keyword
arguments are either used to build the criterion or to specify the bind
parameter values for a given statement....so it would be not quickly
apparent to users which methods could take "session" and which could not.
Yeah, I was going to bring that up. I think it would be better if we kept the
"session" param out of method signatures that take arbitrary keyword args.
Query takes care of that by associating the session with Query internally.
although this time around you can do what I think maybe you wanted,
which is just make your own Query objects with whatever session, i.e.
q = Query(mapper, session=sess)
and youre off. we are not yet doing anything with the SQLEngines or
connections being different, thats next.
That's exactly what I wanted. Thanks.
~ Daniel
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users