mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 12:21:02 +01:00
20 lines
736 B
Python
20 lines
736 B
Python
from ee.clickhouse.queries.funnels.funnel import ClickhouseFunnel
|
|
from ee.clickhouse.sql.funnels.funnel import FUNNEL_PERSONS_BY_STEP_SQL
|
|
from posthog.models import Person
|
|
|
|
|
|
class ClickhouseFunnelPersons(ClickhouseFunnel):
|
|
def get_query(self):
|
|
return FUNNEL_PERSONS_BY_STEP_SQL.format(
|
|
offset=self._filter.offset,
|
|
steps_per_person_query=self.get_step_counts_query(),
|
|
persons_steps=self._get_funnel_person_step_condition(),
|
|
)
|
|
|
|
def _format_results(self, results):
|
|
people = Person.objects.filter(team_id=self._team.pk, uuid__in=[val[0] for val in results])
|
|
|
|
from posthog.api.person import PersonSerializer
|
|
|
|
return PersonSerializer(people, many=True).data
|