The manager and direct reports example was just what my project
needed. I'm looking forward to upgrading to 0.5 in the future so that
I don't have to enter redundant primaryjoin and secondaryjoin on the
backref.

Thank you Mike!

On Jun 28, 1:10 am, Tom Hogarty <[EMAIL PROTECTED]> wrote:
> Wow, thank you very much for the detailed example. It looks like just
> what I need. I look forward to trying it out very soon.
>
> -Tom
>
> On Jun 27, 6:12 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
>
>
> > this relation will require you to configure primaryjoin and  
> > secondaryjoin (it should be raising an error without them).  an  
> > example is attached.
>
> >  test.py
> > 1KDownload
>
> > On Jun 27, 2008, at 5:30 PM, Tom Hogarty wrote:
>
> > > Hello,
>
> > > I have the following scenario where I want the same class/table on
> > > both sides of a relation.
>
> > > person table
> > > - id
> > > - name
>
> > > manager table
> > > - person_id
> > > - manager_id
>
> > > I define both tables and a Person class, then create a relation in the
> > > person mapper like:
> > > 'manager' : relation(Person, secondary=managers,
> > > backref='direct_reports')
>
> > > When I do this, the 'manager' attribute doesn't show up in Person
> > > objects when I query on people. The error I get is:
> > > AttributeError: 'Person' object has no attribute 'manager'
> > > # query is something like
> > > session.query(Person).filter_by(name='Joe').one()
>
> > > Any hints on how I can do this. I have other basic relations working
> > > (1-1, 1-M, M-1) but they all have different classes/tables on each end
> > > of the relation.
>
> > > Regards,
>
> > > -Tom- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to