guotie
V2EX  ›  问与答

sqlalchemy的orm怎么使用or关系?

  •  
  •   guotie · Jun 9, 2012 · 4171 views
    This topic created in 5162 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   ·   Solana   ·   3648 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 00:42 · PVG 08:42 · LAX 17:42 · JFK 20:42
    ♥ Do have faith in what you're doing.