V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
guotie
V2EX  ›  问与答

sqlalchemy的orm怎么使用or关系?

  •  
  •   guotie · 2012-06-09 11:13:52 +08:00 · 3394 次点击
    这是一个创建于 4340 天前的主题,其中的信息可能已经有所发展或是发生改变。
    如题。

    and关系可以用query.filter().filter(),or关系怎么用?文档上没找到。

    谢谢!
    2 条回复    1970-01-01 08:00:00 +08:00
    SErHo
        1
    SErHo  
       2012-06-09 11:33:09 +08:00   ❤️ 1
    guotie
        2
    guotie  
    OP
       2012-06-09 12:26:12 +08:00
    from sqlalchemy import or_
    filter(or_(User.name == 'ed', User.name == 'wendy'))
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1000 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 19:18 · PVG 03:18 · LAX 12:18 · JFK 15:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.