Skip to content

Instantly share code, notes, and snippets.

@Zmey56
Last active September 2, 2022 20:29
Show Gist options
  • Save Zmey56/f9d343214e669a79e8ed78bcc0fdb97b to your computer and use it in GitHub Desktop.
Save Zmey56/f9d343214e669a79e8ed78bcc0fdb97b to your computer and use it in GitHub Desktop.
query_dau_all_q = """select date,
uniqExact(user_id) as users,
uniqExactIf(user_id, os='iOS') as users_ios,
uniqExactIf(user_id, os='Android') as users_and,
uniqExactIf(user_id, gender=1) as users_male,
uniqExactIf(user_id, gender=0) as users_female
from
(select distinct toDate(time) as date, user_id, os, gender
from simulator_20220620.feed_actions
where toDate(time) between today() - 8 and today() - 1
union all
select distinct toDate(time) as date, user_id, os, gender
from simulator_20220620.message_actions
where toDate(time) between today() - 8 and today() - 1) as t
group by date
order by date"""
data_dau_all = pd.DataFrame(ph.read_clickhouse(query=query_dau_all_q, connection=connection))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment