【问题标题】:How to set global level group_concat_max_len in Flask-Sqlalchemy?如何在 Flask-Sqlalchemy 中设置全局级别 group_concat_max_len?
【发布时间】:2018-12-06 01:22:16
【问题描述】:

我们在其中一个查询中使用 group_concat,它返回的字符串大于 group_concat(1024) 的默认长度。我需要在全局级别设置 group_concat_max_len 的最大值,但我无法在 Flask_Sqlalchemy 中找到实现该值的方法。

Request.query
    .with_entities(func.group_concat(func.CONCAT_WS(';', Sample.xyz,Analysis.zy, Analysis.pqr).distinct()))
    .outerjoin(Sample)
    .outerjoin(Analysis)
    .group_by(Request.id).all()

如果有人可以帮助我,请告诉我。

【问题讨论】:

    标签: mysql python-3.x session sqlalchemy flask-sqlalchemy


    【解决方案1】:

    设置全局 group_concat_max_len=10000000;

    运行这个

    【讨论】:

    • 我知道,但是如何在 Falsk-Sqlalchemy 中设置 group_concat_max_len。
    猜你喜欢
    • 2017-09-05
    • 1970-01-01
    • 1970-01-01
    • 2014-09-21
    • 1970-01-01
    • 1970-01-01
    • 2011-03-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多