hts/internal/tinybird/pipes/endpoint_get_usage.pipe

20 lines
564 B
Plaintext

VERSION 3
TOKEN "endpoint_get_usage__v3_endpoint_read_2506" READ
NODE get_usage
SQL >
%
SELECT time, countMerge(count) as usage, sum(ratelimited) as ratelimited
FROM mv__daily_usage
where
workspaceId = {{ String(workspaceId, required=True )}}
{% if defined(apiId) %}
and apiId ={{ String(apiId) }}
{%end if %}
{% if defined(keyId) %}
and keyId ={{ String(keyId) }}
{%end if %}
and time > now() - INTERVAL 30 day
GROUP BY time