On Wed, 23 Nov 2011 10:59:03 +0100
Enrico Morelli <more...@cerm.unifi.it> wrote:


> These are the mappers:
> mapper(Ligand, ligand_table,
>    properties={
>      'ligand':relationship(LigandLigand,
>          primaryjoin=and_(ligand_table.c.id==ligand_ligand_table.c.ligand_id1,
>                    ligand_table.c.id==ligand_ligand_table.c.ligand_id2),
>       backref=backref('ligandligand') ), })
> 
> mapper(LigandLigand, ligand_ligand_table,
>    properties={
>       'first_sphere': relationship(Ligand, 
>            
> primaryjoin=and_(ligand_ligand_table.c.ligand_id2==ligand_table.c.id,
>                             
> ligand_ligand_table.c.ligand_id1==ligand_table.c.id),
>            backref=backref('root')),
>        })
> 
> When I try to access to the ligand.ligand properties, this is empty
> even if in the db there are relations. Where is the problem?
> 
> Thanks
> 
> 

I think to have solved the problem changing the logical operator in the
primaryjoin from and_ to or_. 

Now when I remove the relations I have the following warning:
SAWarning: Multiple rows returned with uselist=False for lazily-loaded attribute
'LigandLigand.ligandligand' value = callable_(passive=passive)

What means?
-- 
-------------------------------------------------------------------
       (o_
(o_    //\  Coltivate Linux che tanto Windows si pianta da solo.
(/)_   V_/_
+------------------------------------------------------------------+
|     ENRICO MORELLI         |  email: more...@cerm.unifi.it       |
| *     *       *       *    |  phone: +39 055 4574269             |
|  University of Florence    |  fax  : +39 055 4574253             |
|  CERM - via Sacconi, 6 -  50019 Sesto Fiorentino (FI) - ITALY    |
+------------------------------------------------------------------+

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