SQLAlchemy JSON列-如何执行包含查询

SQLAlchemy JSON列-如何执行包含查询,第1张

SQLAlchemy JSON列-如何执行包含查询

用途

JSON_ConTAINS(json_doc, val[,path])

from sqlalchemy import func# JSON_ConTAINS returns 0 or 1, not found or found. Not sure if MySQL# likes integer values in WHERe, added == 1 just to be safesession.query(Story).filter(func.json_contains(Story.section_ids, X) == 1).all()

顶层搜索数组时,无需指定 path



欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5631646.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-15
下一篇2022-12-15

发表评论

登录后才能评论

评论列表(0条)

    保存