推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
Fiery123
V2EX  ›  Python

Flask-Sqlalchemy 查询最大值

  •  
  •   Fiery123 · Dec 24, 2018 · 4806 views
    This topic created in 2832 days ago, the information mentioned may be changed or developed.
    请教下 Flask-Sqlalchemy 查询最大值是怎么写? Sqlalchemy 是 func.max FlaskSqlalchemy 没有看到相关的语法。
    4 replies  •  2018-12-25 11:09:10 +08:00
    autotesting
        1
    autotesting  
       Dec 24, 2018
    groupby 后才能用 func.max, func.min 这样
    Fiery123
        2
    Fiery123  
    OP
       Dec 24, 2018
    @autotesting 有参考的例子吗,,现在我的方法是执行原始 sql 语句
    autotesting
        3
    autotesting  
       Dec 24, 2018
    其实很多,https://stackoverflow.com/questions/45775724/sqlalchemy-group-by-and-return-max-date
    你搜关键词 sqlachemy groupby func.max
    Fiery123
        4
    Fiery123  
    OP
       Dec 25, 2018
    @autotesting 我用这样的语法查出来为空
    userbalance_model.query.filter_by(user_id = parse.user_id, asset = parse.coin).with_entities(func.max(userbalance_model.id)).all()
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2580 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 19ms · UTC 05:59 · PVG 13:59 · LAX 22:59 · JFK 01:59
    ♥ Do have faith in what you're doing.