2025-07-16 14:28:41 +08:00

25 lines
504 B
Plaintext

ns = params_kw.copy()
sql = """select a.*, concat(b.name, '(', c.name, ')') as name
from
(select modelinstanceid as mii,
modeltypeid as mti,
count(*) as call_cnt
from feelog
where transdate >= ${start_date}$ and
transdate < ${end_date}$
group by mii, mti
) a,
modelinstance b,
modeltype as c
where a.mii = b.id and
a.mti = c.id
order by call_cnt desc
limit 5
"""
db = DBPools()
async with db.sqlorContext('sage') as sor:
recs = await sor.sqlExe(sql, ns.copy())
return recs
return []