On Sat, Jun 1, 2013 at 10:59 PM, Michael Bayer <mike...@zzzcomputing.com>wrote:

> The recipe on the wiki also has the issue that it isn't even caching
> anything to do with the QueryContext, including all of this information
> regarding eager joins which is pretty important.  Your modifications try to
> correct for this by storing that "context", but then it still creates a
> brand new context anyway and just transfers not nearly enough of its state
> over for things to work.
>

Yes, I was trying to keep it minimal to figure out why the error up there,
but I did start the way you describe, by storing everything
session-independent from the query context.


> So the whole thing is rolled up into the "named" thing I referred to also,
> so that there's no need to keep a Query object hanging around, when we say
> "bake()" we're really just referring to a position in the code somewhere,
> so I've updated the wiki recipe to use a named system like this:
>
> q = s.query(Foo).\
>                 filter(Foo.data == bindparam('foo')).\
>                 bake_as("foo", cache)
>         result = q.params(foo='data 12').all()
>
>
> A highly cleaned up version of your test is attached.
>
> I'm still not sure I'm getting everything accounted for here!  thanks for
> testing !   The feature is actually looking quite simple and probably works
> better as something built in, or at least if we added some methods to
> QueryContext to ease the burden of caching/copying it.
>

Well, if that works, it certainly covers my needs so there would be no
pressing need to incorporate it into the core.
I'll let you know tomorrow.

-- 
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