【问题标题】:Get json length of a column in sql alchemy?在 sql alchemy 中获取列的 json 长度?
【发布时间】:2021-03-09 18:37:04
【问题描述】:

在 mysql 的 sql alchemy 中查询 JSON_LENGTH(json_column) 的正确方法是什么?

我已经尝试过这个查询,但出现错误:(pymysql.err.InternalError) (1305, 'FUNCTION test_db.json_array_length does not exist')

查询:

self.session.query(func.json_array_length(DbModelName.data)).all()   

【问题讨论】:

    标签: mysql json


    【解决方案1】:

    请找到这个帖子SqlAlchemy: Querying the length json field having an array

    对于 mysql,请将方法更新为 json_length。否则会出现上述错误

    一切正常

    【讨论】:

      猜你喜欢
      • 2022-10-02
      • 2017-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-30
      • 1970-01-01
      • 2021-02-28
      相关资源
      最近更新 更多