0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 18:26:15 +01:00
posthog/ee/clickhouse/sql/funnels/funnel.py
2020-10-29 12:25:02 +01:00

17 lines
476 B
Python

FUNNEL_SQL = """
SELECT
pid.person_id as id,
windowFunnel(6048000000000000)(toUInt64(toUnixTimestamp64Micro(timestamp)),
{steps}
)
FROM
events
JOIN (
SELECT person_id, distinct_id FROM person_distinct_id WHERE team_id = %(team_id)s
) as pid
ON pid.distinct_id = events.distinct_id
WHERE
team_id = %(team_id)s {filters} {parsed_date_from} {parsed_date_to}
GROUP BY pid.person_id
"""