Excellent, this seems to be working!

It looks like the AppenderMixin defines it's own version of __iter__() and
count().

My CachingQuery does this as well.  I have versions of those two functions
that check/set the cache, forwarding to the Query versions to hit the db if
necessary.

So what I'm doing at the moment with my CachingQuery + AppenderMixin is
patching the resulting type, after the mixin happens, with versions that
check/set the cache and call the mixin versions if necessary.

Does that sound like a sane approach to you?  Or would you recommend
something different?

Actually... maybe I should patch AppenderMixin before the mixin happens.  Or
put a decorator on its versions of __iter__() and count().   (Not sure if
this is possible, it occured to me just as I stare at the code and type
this...)

btw... we are still using 6.5, our version of relationship() also accepts
the query_class param.

thanks again,
-bill




On Tue, May 24, 2011 at 5:39 PM, Michael Bayer <mike...@zzzcomputing.com>wrote:

> slight documentation failure, now resolved.  check out query_class at
> http://www.sqlalchemy.org/docs/orm/relationships.html#sqlalchemy.orm.relationship.
>
>
> On May 24, 2011, at 4:57 PM, Bill Curtis wrote:
>
> > I have model object with particular property defined as a lazy="dynamic"
> relationship.
> >
> > When I look at the __class__ of this property in the debugger, I get
> this:
> >
> >      sqlalchemy.orm.dynamic.AppenderQuery
> >
> > and when I inspect it's __bases__, I get this:
> >
> >      (<class 'sqlalchemy.orm.dynamic.AppenderMixin'>, <class
> 'sqlalchemy.orm.query.Query'>)
> >
> > I would like this query object to inherit from my caching_query class, so
> I can get it to play with our beaker caching system.
> >
> > Is there some way to do this?  Or some other approach I should be
> thinking about instead?
> >
> > I am currently passing my caching_query class to sessionmaker(), and
> calls to Session.query() return correctly return caching_query instances.
> >
> > --bill
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> > To post to this group, send email to sqlalchemy@googlegroups.com.
> > To unsubscribe from this group, send email to
> sqlalchemy+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>

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

Reply via email to