V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2015-04-27 20:51:34 +08:00 · 3972 次点击
    这是一个创建于 3276 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    大惑不解。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4240 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 10:16 · PVG 18:16 · LAX 03:16 · JFK 06:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.