我正试图找到一种使用sqlbuilder.smartsql (python )在Postgres中使用聚合函数的方法。但我做不到。
文档也没有任何用例:https://sqlbuilder.readthedocs.io/en/latest/
我试过使用以下方法:
q = q.fields(e(func.avg(T.author.age))
追踪(最近一次调用):文件"",第1行,在NameError: name 'func‘中没有定义
试过了几种方法,但没有运气。
问题:
sqlbuilder.smartsql
发布于 2022-04-13 09:24:53
找到了调用聚合函数(或任何其他postgres函数)的方法
>>> q
<Query: SELECT *, AVG("author"."age") FROM "author", []>```https://stackoverflow.com/questions/71853641
复制相似问题