>From the problem I posted the other day(http://tinyurl.com/25cw7m), I
finally found the problem may be resulted cos TurboEntity. Please see
the following code in my model.

# This is the model using TurboEntity.
# But the relationships between tables won't be joined successfully.
class Artist(Entity):
    name = Column(Unicode(255), nullable=False, unique=True)
    songs = OneToMany("Song")

class Song(Entity):
    name = Column(Unicode(255), nullable=False)
    artist = ManyToOne("Artist")

# This is the model using plain SA and assign_mapper
# Everything works fine in controller.
artist_table = Table('artists', metadata,
    Column('id', Integer, primary_key=True),
    Column('name', Unicode(255), nullable=False, unique=True)
)

song_table = Table('songs', metadata,
    Column('id', Integer, primary_key=True),
    Column('artist_id', Integer, ForeignKey('artists.id'),
nullable=False),
    Column('name', Unicode(255), nullable=False)
)

class Artist(object):
    pass

class Song(object):
    pass

assign_mapper(session.context, Artist, artist_table)
assign_mapper(session.context, Song, song_table,
    properties={
        'artist': relation(Artist, backref='songs')
    }
)

Does anyone get the same issue?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to