On Wednesday 17 December 2008 00:35:03 Michael Bayer wrote:
> On Dec 16, 2008, at 3:04 PM, a...@svilendobrev.com wrote:
> > hi
> > i have a relation say, foo. i want to have another descriptor,
> > bar that does certain other things around that relation, but can
> > be used just in same way as foo can in the aspects of expressions
> > and query-joins.
> >
> > i.e. query(A).join( A.foo) and query(A).join( A.bar)
> > to produce same thing; as well as
> > query(A).filter( A.foo == x) and query(A).filter( A.bar == x).
>
> this is the use case for synonym().
>
> > i managed to get the latter by simulating the PropComparator
> > interface, and i sort of managed to get the join working...
> > but my relation is to an explicit association and i want to hide
> > the explicitness. so i want query(A).join( A.bar)
> > to behave same as
> > query(A).join( A.bar).join( FooAssoc.otherside),
> > or actualy as query(A).join( A.foo) as IF foo was implicit
> > association via secondary table.
>
> ignoring the "A.bar would be 'the same' as A.bar.otherside" portion
> of what you said, since that doesn't make any sense, 
where did i say "be same"? i said "behave same"

> it seems 
> you're asking for A.foo to mean the same thing as A.bar.otherside. 
> this seems something like associationproxy plus a
> comparable_property(). have you tried that ?
the role of assoc_proxy is played by my descriptor.. well, sort-a.
looking at code of comparable_property i dont see how it can hint the 
query.join() to jump over to otherside.
oh well. seems i'll have to overload query.join / filter_by to do 
this "syntax" sugar for me... the internal logic of obtaining 
secondary_table is too complicated to try cheating it.

bye
svil
www.svilendobrev.com

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