在 grafana 的查询构建器中编写 mysql 自定义查询
Write mysql custom query in query builder of grafana
我附上了时间序列图截图,生成的query是
SELECT
UNIX_TIMESTAMP(date_of_sign_up) DIV 600 * 600 AS "time",
status AS "borrower_status",
count(id) AS "Number Of Borrowers"
FROM borrowers
WHERE
date_of_sign_up BETWEEN FROM_UNIXTIME(1631158800) AND FROM_UNIXTIME(1643881661) AND
status IN ('APPROVED','INACTIVE','BASIC') AND
client_id = 130454654
GROUP BY 1, status
ORDER BY UNIX_TIMESTAMP(date_of_sign_up) DIV 600 * 600
现在我想在 mysql 查询构建器中从 url 传递,下面是我尝试编写但没有成功的查询
SELECT
$__timeGroupAlias(date_of_sign_up,10m),
status AS "borrower_status",
count(id) AS "Number Of Borrowers"
FROM borrowers
WHERE
date_of_signup between $from AND $to AND
status IN (${BorrowerStatus}) AND
client_id = [[tenant]]
GROUP BY 1, status
ORDER BY $__timeGroup(date_of_sign_up,10m)
在 MySQL 查询构建器 date_of_signup 之间
中从 URL 参数传递 &from 和 &to 的正确方法是什么]
date_of_signup between $__timeFrom() AND $__timeTo()
我附上了时间序列图截图,生成的query是
SELECT
UNIX_TIMESTAMP(date_of_sign_up) DIV 600 * 600 AS "time",
status AS "borrower_status",
count(id) AS "Number Of Borrowers"
FROM borrowers
WHERE
date_of_sign_up BETWEEN FROM_UNIXTIME(1631158800) AND FROM_UNIXTIME(1643881661) AND
status IN ('APPROVED','INACTIVE','BASIC') AND
client_id = 130454654
GROUP BY 1, status
ORDER BY UNIX_TIMESTAMP(date_of_sign_up) DIV 600 * 600
现在我想在 mysql 查询构建器中从 url 传递,下面是我尝试编写但没有成功的查询
SELECT
$__timeGroupAlias(date_of_sign_up,10m),
status AS "borrower_status",
count(id) AS "Number Of Borrowers"
FROM borrowers
WHERE
date_of_signup between $from AND $to AND
status IN (${BorrowerStatus}) AND
client_id = [[tenant]]
GROUP BY 1, status
ORDER BY $__timeGroup(date_of_sign_up,10m)
在 MySQL 查询构建器 date_of_signup 之间
中从 URL 参数传递 &from 和 &to 的正确方法是什么]date_of_signup between $__timeFrom() AND $__timeTo()