mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-29 02:46:32 +01:00
06cf6562e3
* add aliases * select specific
16 lines
644 B
Python
16 lines
644 B
Python
FUNNEL_SQL = """
|
|
SELECT id, {select_steps} FROM (
|
|
SELECT
|
|
person_distinct_id.person_id as id,
|
|
groupArray(events.timestamp) as timestamps,
|
|
groupArray(events.event) as eventsArr,
|
|
groupArray(events.uuid) as event_ids,
|
|
{steps}
|
|
FROM events
|
|
JOIN (SELECT person_id, distinct_id FROM person_distinct_id WHERE team_id = %(team_id)s) as person_distinct_id ON person_distinct_id.distinct_id = events.distinct_id
|
|
WHERE team_id = %(team_id)s {filters} {parsed_date_from} {parsed_date_to}
|
|
GROUP BY person_distinct_id.person_id, team_id
|
|
ORDER BY timestamps
|
|
) WHERE step_0 <> toDateTime(0)
|
|
"""
|