Not much detail to tell what is wrong. Here is a contrived but working
example based on one of my examples:
ut = Table('user',meta,
Column('uid',String,primary_key=True),
Column('name',String)
)
kt = Table('keywords',meta,
Column('keyword',String,primary_key=True)
)
ukt = Table('userkeywords',meta,
Column('uid',String,ForeignKey('user.uid')),
Column('kw',String,ForeignKey('keywords.keyword'))
)
class User(Base):
__table__ = ut
keywords = relation('Keyword',
secondary=ukt,
backref='users')
def __repr__(s): return "<User %s:%s>" % (s.uid,s.name)
class Keyword(Base):
__table__ = kt
def __repr__(s): return "<Keyword %s>" % s.keyword
q = session.query(User).\
select_from(join(ut,ukt,ut.c.uid==ukt.c.uid)).\
filter(case([(ut.c.uid=='mike','M'),
(ut.c.uid=='sue','F')],
else_='X') == 'M')
--
Mike Conley
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---