On Apr 9, 2:48 pm, "Michael Bayer" <[email protected]> wrote:
> mdoar wrote:
>
> > Makes sense. Since I'm using reflection and declarative, I have code
> > like
>
> >                 aTable = Table(tablename, Base.metadata,
> >                                Column('dbid', primary_key=True),
> >                                Column('state', index=True),
> >                                useexisting=True)
> >                 ....
> >                 clz = type(classname, (Base,), {'__table__' : aTable})
>
> > and then define a relation later on with:
>
> >         Defect.stateObj = orm.relation(Statedef,
>
> > primaryjoin=Defect.state==Statedef.id,
> >                                        foreign_keys=
> > [Statedef.__table__.columns['id'] ])
>
> i think you mean to say here that foreign_keys=Defect.state.  if the
> foreign keys are on the "other" side, thats one to many.

I do indeed have it set up as one to many and then I get the first
instance.
Does that change the solution?

>
> >> 1. strongly referenced somewhere, or weak_identity_map=False on your
> >> session.  else the object is garbage collected and SQL is required to
> >> load
> >> it.
>
> > weak_identity_map=False is the default. Looking at the documentation,
> > perhaps you meant "weak_identity_map=True"?
>
> True is the default in 4 and above and it seems like the docstring has it
> backwards, so that is fixed in r5903.
--~--~---------~--~----~------------~-------~--~----~
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