mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-02 08:28:18 +00:00
Add databox analytics queries
This commit is contained in:
1 parent
7178843565
commit
bc21102c20
2 files changed
+69
No files matched your search
@@ -0,0 +1,34 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Generations by account recency histogram
|
||||
select
|
||||
created_date,
|
||||
case when user_account_age_days <= 1 then 'today'
|
||||
when user_account_age_days <= 30 then '<1 month'
|
||||
when user_account_age_days <= 60 then '<2 month'
|
||||
when user_account_age_days <= 90 then '<3 month'
|
||||
when user_account_age_days <= 365 then '<1 year'
|
||||
else '1+ years' end as user_account_age,
|
||||
count(*) as generations
|
||||
FROM (
|
||||
SELECT
|
||||
DATE(gij.created_at) as created_date,
|
||||
-- Account age at time of media generation
|
||||
DATEDIFF(gij.created_at, u.created_at) as user_account_age_days
|
||||
from
|
||||
generic_inference_jobs as gij
|
||||
join
|
||||
users as u
|
||||
on
|
||||
gij.maybe_creator_user_token = u.token
|
||||
where
|
||||
gij.created_at >= (CURDATE() - INTERVAL 30 DAY)
|
||||
and gij.status = 'complete_success'
|
||||
and gij.id > 40839206
|
||||
order by gij.created_at asc
|
||||
) as x
|
||||
group by created_date, user_account_age
|
||||
order by created_date asc, user_account_age asc;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Generations by account recency histogram
|
||||
select
|
||||
created_date,
|
||||
case when user_account_age_days <= 1 then 'today'
|
||||
when user_account_age_days <= 30 then '<1 month'
|
||||
when user_account_age_days <= 60 then '<2 month'
|
||||
when user_account_age_days <= 90 then '<3 month'
|
||||
when user_account_age_days <= 365 then '<1 year'
|
||||
else '1+ years' end as user_account_age,
|
||||
count(distinct user_token) as dau_count
|
||||
FROM (
|
||||
SELECT
|
||||
DATE(gij.created_at) as created_date,
|
||||
-- Account age at time of media generation
|
||||
DATEDIFF(gij.created_at, u.created_at) as user_account_age_days,
|
||||
u.token as user_token
|
||||
from
|
||||
generic_inference_jobs as gij
|
||||
join
|
||||
users as u
|
||||
on
|
||||
gij.maybe_creator_user_token = u.token
|
||||
where
|
||||
gij.created_at >= (CURDATE() - INTERVAL 30 DAY)
|
||||
and gij.status = 'complete_success'
|
||||
and gij.id > 40839206
|
||||
order by gij.created_at asc
|
||||
) as x
|
||||
group by created_date, user_account_age
|
||||
order by created_date asc, user_account_age asc;
|
||||
|
||||
Reference in new issue
Block a user