Skip to content

Instantly share code, notes, and snippets.

@Zmey56
Last active September 2, 2022 20:25
Show Gist options
  • Save Zmey56/121d9b75bb444cd3322182193bc08151 to your computer and use it in GitHub Desktop.
Save Zmey56/121d9b75bb444cd3322182193bc08151 to your computer and use it in GitHub Desktop.
query_feed_q = """
select
toDate(time) as date
,count(distinct user_id) as users_feed
,countIf(action='like') as likes
,countIf(action='view') as views
,countIf(action='like') / countIf(action='view') as CTR
,likes+views as events
from simulator_20220620.feed_actions
where toDate(time) between today() - 8 and today() - 1
group by date
order by date
"""
data_feed = pd.DataFrame(ph.read_clickhouse(query=query_feed_q, connection=connection))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment