0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/ee/clickhouse/queries/retention/retention_event_query.py
Yakko Majuri 3f53c815c7
feat(poe-v2): scaffolding for PoE v2 on event queries, full support in retention queries (#14830)
* add initial scaffolding

* _get_distinct_id_query --> _get_person_ids_query

* retention query changes

* full retention support for v2

* Update query snapshots

* add comments

* Update query snapshots

* debug local vs remote

* fix tests

* another try at debugging

* fix?

* Update query snapshots

* Update query snapshots

* fix

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-03-21 11:50:12 -03:00

17 lines
698 B
Python

from posthog.models.group.util import get_aggregation_target_field
from posthog.queries.retention.retention_events_query import RetentionEventsQuery
class ClickhouseRetentionEventsQuery(RetentionEventsQuery):
def target_field(self) -> str:
if self._aggregate_users_by_distinct_id and not self._filter.aggregation_group_type_index:
return f"{self.EVENT_TABLE_ALIAS}.distinct_id AS target"
else:
return "{} as target".format(
get_aggregation_target_field(
self._filter.aggregation_group_type_index,
self.EVENT_TABLE_ALIAS,
self._person_id_alias,
)
)