hts/internal/tinybird/pipes/aggregate_verifications_mon...

22 lines
682 B
Plaintext

VERSION 1
NODE key_verifications_pipe_7424_0
DESCRIPTION >
Internal Stats - How many legit verifications we do per month
SQL >
SELECT
countState() AS verifications,
uniqState(keyId) AS activeKeys,
uniqState(workspaceId) AS activeWorkspaces,
toStartOfMonth(fromUnixTimestamp64Milli(time)) AS month
FROM key_verifications
WHERE (workspaceId != 'ws_QXaikfWEdwe1uvYw1QXpSa') AND (workspaceId != 'ws_4GKWTRr6vyEyh4wEAZJsPg') AND (workspaceId != 'ws_GcQBeZ51Z1VPDxX3TSSi9t')
GROUP BY month
TYPE materialized
DATASOURCE mv__monthly_stats
ENGINE "AggregatingMergeTree"
ENGINE_PARTITION_KEY "toYYYYMM(month)"
ENGINE_SORTING_KEY "month"