Cool, it's very powerful, it will allow me to save my Bandwidth because i
take just what i want and not the entire object.

Thanks Conor

2009/11/24 Conor <[email protected]>

> Christian Démolis wrote:
> > Thx for your answer Thomas
> >
> > I want the attribute to not return the complete object just some of
> > the attribute of the other table.
> >
> > In my case Utilisateur has some attributes : Login, Nom, Prenom, ...
> > I dont want Verouillage.LeNomDuUtilisateur to return complete object
> > Utilisateur
> > I want it to return only Login attributes.
> >
> > Primaryjoin seems to work on condition (where clause) and not on
> > select condition (select ... in a query)
> >
> > Is it possible to limit selected attributes in the relation?
> >
>
> You can use sqlalchemy.ext.associationproxy.association_proxy to turn a
> collection of related objects into a collection of related object
> attributes:
> _LeUtilisateur = relation(Utilisateur, backref=backref('verrouillage'))
> LeNomDuUtilisateur = association_proxy('_LeUtilisateur', 'Login')
>
> -Conor
>
> > 2009/11/24 Tefnet Developers - Tomasz Jezierski <[email protected]
> > <mailto:[email protected]>>
> >
> >     Dnia 2009-11-24, Wt o godzinie 11:18 +0100, Christian Démolis pisze:
> >     > Is it possible to put a filter on a relation in the declaration?
> >     >
> >     > Example :
> >     > LeNomDuUtilisateur = relation(Utilisateur,
> >     > filter_by=Utilisateur.Login, backref=backref('verrouillage'))
> >
> >     I'm not sure what exactly your example means.. but if you want extra
> >     filters on relation, you can change primaryjoin
> >
> http://www.sqlalchemy.org/docs/05/mappers.html#specifying-alternate-join-conditions-to-relation
> >
> >     something like:
> >     LeNomDuUtilisateur = relation(Utilisateur,
> >     primaryjoin=sqlalchemy.and_(defaultjoincondition,
> >     yourextrafiltercondition), backref='verrouillage')
> >
> >
> >     Tomasz Jezierski
> >     Tefnet
> >     www.tefnet.pl <http://www.tefnet.pl>
> >
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<sqlalchemy%[email protected]>
> .
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.


Reply via email to