guotie
V2EX  ›  问与答

sqlalchemy的orm怎么使用or关系?

  •  
  •   guotie · Jun 9, 2012 · 4274 views
    This topic created in 5248 days ago, the information mentioned may be changed or developed.
    如题。

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

    谢谢!
    2 replies  •  1970-01-01 08:00:00 +08:00
    SErHo
        1
    SErHo  
       Jun 9, 2012   ❤️ 1
    guotie
        2
    guotie  
    OP
       Jun 9, 2012
    from sqlalchemy import or_
    filter(or_(User.name == 'ed', User.name == 'wendy'))
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1247 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 69a29122 · 34ms · UTC 21:36 · PVG 05:36 · LAX 14:36 · JFK 17:36
    ♥ Do have faith in what you're doing.