Skip to content

Commit 3912a96

Browse files
committed
apis
1 parent bcf6d4d commit 3912a96

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
TOKEN "read" READ
2+
3+
TAGS "stripe"
4+
5+
NODE ep
6+
SQL >
7+
8+
SELECT
9+
countIf(event_type == 'customer.subscription.created') as created,
10+
countIf(event_type == 'customer.subscription.deleted') as deleted
11+
FROM stripe
12+
where event_type = 'customer.subscription.created' or event_type = 'customer.subscription.deleted'
13+
14+

tinybird/pipes/stripe_subs_ts.pipe

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
TOKEN "read" READ
2+
3+
TAGS "stripe"
4+
5+
NODE ep
6+
SQL >
7+
8+
SELECT
9+
toDate(toStartOfDay(event_time)) as day,
10+
countIf(event_type == 'customer.subscription.created') as created,
11+
countIf(event_type == 'customer.subscription.deleted') as deleted
12+
FROM stripe
13+
where event_type = 'customer.subscription.created' or event_type = 'customer.subscription.deleted'
14+
and event_time >= now() - interval 30 day
15+
group by day
16+
order by day asc
17+
18+

0 commit comments

Comments
 (0)