two tricks here - set up SpeciesSynonym as:

class SpeciesSynonym(object):
     def __init__(self, species):
         self.synonym = species

that it wasnt raising an exception for no constructor is a bug -  
ticket #908 added.

The other thing that helps here is to set up your bidirectional  
relation using a backref, so that the opposite side is set  
automatically:

mapper(Species, species_table,
    properties = \
        {'_synonyms':
         relation(SpeciesSynonym,
             
primaryjoin=species_table.c.id==species_synonym_table.c.species_id,
            cascade='all, delete-orphan', uselist=True,  
backref="species"
                  )})

mapper(SpeciesSynonym, species_synonym_table,
    properties = \
       {
       'synonym':
        relation(Species, uselist=False,
         
primaryjoin=species_synonym_table.c.synonym_id==species_table.c.id),
       })



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