V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
zuo
V2EX  ›  Python

Flask-SQLALchemy 查询操作疑问

  •  
  •   zuo · Apr 27, 2015 · 4928 views
    This topic created in 4029 days ago, the information mentioned may be changed or developed.

    做微信的openid绑定验证,首先用openid进行一次查询,判断为空后,进行绑定。第二次通过微信菜单点击进去后,判断条件结果还是空值!
    将服务断掉后,在重启服务,这个时候判断条件结果又有对象值了!不知道为什么会是这样?
    return Custormer.query.filter_by(openid = openid).first()

    2 replies    2015-07-25 13:34:05 +08:00
    ihciah
        1
    ihciah  
       Apr 27, 2015
    commit了么
    theo
        2
    theo  
       Jul 25, 2015
    我也遇到类似的问题,新 add 一条数据并 commit 后,使用 mysql 包可以查询到,用 SQLAlchemy (没有用 Falsk-SQLAlchemy)查询不到。重启 Python 服务后均可以查询到。

    大惑不解。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   930 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 21:00 · PVG 05:00 · LAX 14:00 · JFK 17:00
    ♥ Do have faith in what you're doing.