:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore: remove leftovers of the legacy filter classes (#124221)
Thomas Obermüllercf660731c662
diff --git a/ee/clickhouse/queries/test/test_cohort_query.py b/ee/clickhouse/queries/test/test_cohort_query.pyindex 8ced19d78884..ad64ed4f4d9e 100644--- a/ee/clickhouse/queries/test/test_cohort_query.py+++ b/ee/clickhouse/queries/test/test_cohort_query.py@@ -74,12 +74,8 @@ def execute(filter: PropertyGroup, team: Team):return cohort_query.hogql_result.results-def _properties(data: dict, team: Optional[Team] = None) -> PropertyGroup:- """Parse a legacy insight-filter dict down to the property group CohortQuery takes.-- A team expands cohort properties, as a team-bound filter used to.- """- parsed = parse_property_group_data(data.get("properties"))+def _properties(properties: dict[str, Any], team: Optional[Team] = None) -> PropertyGroup:+ parsed = parse_property_group_data(properties)return expand_cohort_properties(parsed, team) if team else parsed@@ -161,54 +157,52 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):)flush_persons_and_events()- data = {- "properties": {- "type": "AND",- "values": [- {- "type": "OR",- "values": [- {- "key": "$pageview",- "event_type": "events",- "time_value": 1,- "time_interval": "day",- "value": "performed_event",- "type": "behavioral",- },- {- "key": "$pageview",- "event_type": "events",- "time_value": 2,- "time_interval": "week",- "value": "performed_event",- "type": "behavioral",- },- ],- },- {- "type": "AND",- "values": [- {- "key": action1.pk,- "event_type": "actions",- "time_value": 2,- "time_interval": "week",- "value": "performed_event_first_time",- "type": "behavioral",- },- {- "key": "email",- "value": "[email protected]",- "type": "person",- },- ],- },- ],- }+ properties = {+ "type": "AND",+ "values": [+ {+ "type": "OR",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 1,+ "time_interval": "day",+ "value": "performed_event",+ "type": "behavioral",+ },+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 2,+ "time_interval": "week",+ "value": "performed_event",+ "type": "behavioral",+ },+ ],+ },+ {+ "type": "AND",+ "values": [+ {+ "key": action1.pk,+ "event_type": "actions",+ "time_value": 2,+ "time_interval": "week",+ "value": "performed_event_first_time",+ "type": "behavioral",+ },+ {+ "key": "email",+ "value": "[email protected]",+ "type": "person",+ },+ ],+ },+ ],}- filter = _properties(data=data)+ filter = _properties(properties)res = execute(filter, self.team)@@ -217,7 +211,7 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):# This addition to the test returns the wrong result with current cohort queries# Uncomment after porting"""- data["properties"]["values"][0]["values"].append(+ properties["values"][0]["values"].append({"key": "email","value": "[email protected]",@@ -225,7 +219,7 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):})- filter = _properties(data=data)+ filter = _properties(properties)res = execute(filter, self.team)@@ -261,19 +255,17 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "explicit_datetime": "-1w",- "value": "performed_event",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "explicit_datetime": "-1w",+ "value": "performed_event",+ "type": "behavioral",+ }+ ],})@@ -310,19 +302,17 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "explicit_datetime": "-1w",- "value": "performed_event",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "explicit_datetime": "-1w",+ "value": "performed_event",+ "type": "behavioral",+ }+ ],})@@ -370,26 +360,24 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "explicit_datetime": str(- datetime.now() - timedelta(days=3)- ), # overrides time_value and time_interval- "time_value": 1,- "time_interval": "week",- "value": "performed_event",- "type": "behavioral",- "event_filters": [- {"key": "$filter_prop", "value": "something", "operator": "exact", "type": "event"}- ],- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "explicit_datetime": str(+ datetime.now() - timedelta(days=3)+ ), # overrides time_value and time_interval+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event",+ "type": "behavioral",+ "event_filters": [+ {"key": "$filter_prop", "value": "something", "operator": "exact", "type": "event"}+ ],+ }+ ],})@@ -445,20 +433,18 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "explicit_datetime": "-14d",- "explicit_datetime_to": "-7d",- "value": "performed_event",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "explicit_datetime": "-14d",+ "explicit_datetime_to": "-7d",+ "value": "performed_event",+ "type": "behavioral",+ }+ ],})@@ -503,22 +489,20 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "operator": "gte",- "operator_value": 1,- "time_value": 1,- "time_interval": "week",- "value": "performed_event_multiple",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "operator": "gte",+ "operator_value": 1,+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event_multiple",+ "type": "behavioral",+ }+ ],})@@ -570,26 +554,24 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "operator": "gte",- "operator_value": 1,- "time_value": 1,- "time_interval": "week",- "value": "performed_event_multiple",- "type": "behavioral",- "event_filters": [- {"key": "$filter_prop", "value": "something", "operator": "exact", "type": "event"},- {"key": "$filter_prop", "value": "some", "operator": "icontains", "type": "event"},- ],- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "operator": "gte",+ "operator_value": 1,+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event_multiple",+ "type": "behavioral",+ "event_filters": [+ {"key": "$filter_prop", "value": "something", "operator": "exact", "type": "event"},+ {"key": "$filter_prop", "value": "some", "operator": "icontains", "type": "event"},+ ],+ }+ ],})@@ -639,22 +621,20 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "operator": "lte",- "operator_value": 1,- "time_value": 1,- "time_interval": "week",- "value": "performed_event_multiple",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "operator": "lte",+ "operator_value": 1,+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event_multiple",+ "type": "behavioral",+ }+ ],})@@ -711,57 +691,53 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "OR",- "values": [- {- "key": "$pageview",- "event_type": "events",- "operator": "eq",- "operator_value": 1,- "time_value": 1,- "time_interval": "week",- "value": "performed_event_multiple",- "type": "behavioral",- },- {- "key": "$pageview",- "event_type": "events",- "operator": "eq",- "operator_value": 2,- "time_value": 1,- "time_interval": "week",- "value": "performed_event_multiple",- "type": "behavioral",- },- ],- }- }- )-- res = execute(filter, self.team)+ {+ "type": "OR",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "operator": "eq",+ "operator_value": 1,+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event_multiple",+ "type": "behavioral",+ },+ {+ "key": "$pageview",+ "event_type": "events",+ "operator": "eq",+ "operator_value": 2,+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event_multiple",+ "type": "behavioral",+ },+ ],+ }+ )++ res = execute(filter, self.team)assert {p1.uuid, p2.uuid, p3.uuid} == {r[0] for r in res}def test_performed_event_zero_times_(self):filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "operator": "eq",- "operator_value": 0,- "time_value": 1,- "time_interval": "week",- "value": "performed_event_multiple",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "operator": "eq",+ "operator_value": 0,+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event_multiple",+ "type": "behavioral",+ }+ ],})with pytest.raises(ValueError):@@ -796,22 +772,20 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "time_value": 2,- "time_interval": "week",- "seq_time_value": 1,- "seq_time_interval": "week",- "value": "stopped_performing_event",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 2,+ "time_interval": "week",+ "seq_time_value": 1,+ "seq_time_interval": "week",+ "value": "stopped_performing_event",+ "type": "behavioral",+ }+ ],})@@ -886,22 +860,20 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "time_value": 1,- "time_interval": "week",- "seq_time_value": 2,- "seq_time_interval": "day",- "value": "restarted_performing_event",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 1,+ "time_interval": "week",+ "seq_time_value": 2,+ "seq_time_interval": "day",+ "value": "restarted_performing_event",+ "type": "behavioral",+ }+ ],})@@ -942,20 +914,18 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):timestamp=datetime.now() - timedelta(days=4),)filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "time_value": 1,- "time_interval": "week",- "value": "performed_event_first_time",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event_first_time",+ "type": "behavioral",+ }+ ],})@@ -999,19 +969,17 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "explicit_datetime": "-1w", # first event must fall within the last week- "value": "performed_event_first_time",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "explicit_datetime": "-1w", # first event must fall within the last week+ "value": "performed_event_first_time",+ "type": "behavioral",+ }+ ],})@@ -1075,20 +1043,18 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "explicit_datetime": "-14d",- "explicit_datetime_to": "-7d",- "value": "performed_event_first_time",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "explicit_datetime": "-14d",+ "explicit_datetime_to": "-7d",+ "value": "performed_event_first_time",+ "type": "behavioral",+ }+ ],})@@ -1109,24 +1075,22 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):# Regularly completed [$pageview] [at least] [1] times per# [3][day] period for at least [3] of the last [3] periodsfilter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "operator": "gte",- "operator_value": 1,- "time_interval": "day",- "time_value": 3,- "total_periods": 3,- "min_periods": 3,- "value": "performed_event_regularly",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "operator": "gte",+ "operator_value": 1,+ "time_interval": "day",+ "time_value": 3,+ "total_periods": 3,+ "min_periods": 3,+ "value": "performed_event_regularly",+ "type": "behavioral",+ }+ ],})@@ -1147,24 +1111,22 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):# Regularly completed [$pageview] [at least] [1] times per# [3][day] period for at least [3] of the last [3] periodsfilter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "operator": "gte",- "operator_value": 2,- "time_interval": "month",- "time_value": 2,- "total_periods": 3,- "min_periods": 2,- "value": "performed_event_regularly",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "operator": "gte",+ "operator_value": 2,+ "time_interval": "month",+ "time_value": 2,+ "total_periods": 3,+ "min_periods": 2,+ "value": "performed_event_regularly",+ "type": "behavioral",+ }+ ],})@@ -1201,31 +1163,29 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):# Filter for:# Regularly completed [$pageview] [at least] [1] times per# [3][day] period for at least [3] of the last [3] periods- data: dict[str, Any] = {- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "operator": "gte",- "operator_value": 1,- "time_interval": "day",- "time_value": 1,- "total_periods": 7,- "min_periods": 3,- "value": "performed_event_regularly",- "type": "behavioral",- }- ],- }+ properties: dict[str, Any] = {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "operator": "gte",+ "operator_value": 1,+ "time_interval": "day",+ "time_value": 1,+ "total_periods": 7,+ "min_periods": 3,+ "value": "performed_event_regularly",+ "type": "behavioral",+ }+ ],}- filter = _properties(data=data)+ filter = _properties(properties)res = execute(filter, self.team)assert sorted([p1.uuid, p2.uuid, p3.uuid]) == sorted([r[0] for r in res])- data["properties"]["values"][0] |= {"time_value": 2, "total_periods": 3, "min_periods": 3}+ properties["values"][0] |= {"time_value": 2, "total_periods": 3, "min_periods": 3}res = execute(filter, self.team)assert sorted([p1.uuid, p2.uuid]) == sorted([r[0] for r in res])@@ -1255,24 +1215,22 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):# Regularly completed [$pageview] [at least] [2] times per# [3][day] period for at least [2] of the last [3] periodsfilter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "operator": "gte",- "operator_value": 2,- "time_interval": "day",- "time_value": 3,- "total_periods": 3,- "min_periods": 2,- "value": "performed_event_regularly",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "operator": "gte",+ "operator_value": 2,+ "time_interval": "day",+ "time_value": 3,+ "total_periods": 3,+ "min_periods": 2,+ "value": "performed_event_regularly",+ "type": "behavioral",+ }+ ],})@@ -1284,24 +1242,22 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):# Regularly completed [$pageview] [at least] [1] times per# [3][day] period for at least [2] of the last [3] periodsfilter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "operator": "gte",- "operator_value": 1,- "time_interval": "day",- "time_value": 3,- "total_periods": 3,- "min_periods": 2,- "value": "performed_event_regularly",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "operator": "gte",+ "operator_value": 1,+ "time_interval": "day",+ "time_value": 3,+ "total_periods": 3,+ "min_periods": 2,+ "value": "performed_event_regularly",+ "type": "behavioral",+ }+ ],})@@ -1332,38 +1288,36 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):)filter = _properties(- data={- "properties": {- "type": "OR",- "values": [- {- "type": "OR",- "values": [- {- "key": "email",- "value": "[email protected]",- "type": "person",- },- {- "key": "email",- "value": "[email protected]",- "type": "person",- },- ],- },- {- "type": "AND",- "values": [- {"key": "name", "value": "test3", "type": "person"},- {- "key": "email",- "value": "[email protected]",- "type": "person",- },- ],- },- ],- }+ {+ "type": "OR",+ "values": [+ {+ "type": "OR",+ "values": [+ {+ "key": "email",+ "value": "[email protected]",+ "type": "person",+ },+ {+ "key": "email",+ "value": "[email protected]",+ "type": "person",+ },+ ],+ },+ {+ "type": "AND",+ "values": [+ {"key": "name", "value": "test3", "type": "person"},+ {+ "key": "email",+ "value": "[email protected]",+ "type": "person",+ },+ ],+ },+ ],})@@ -1442,56 +1396,54 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "type": "OR",- "values": [- {- "key": "$pageview",- "event_type": "events",- "time_value": 1,- "time_interval": "day",- "value": "performed_event",- "type": "behavioral",- },- {- "key": "$pageview",- "event_type": "events",- "time_value": 2,- "time_interval": "week",- "value": "performed_event",- "type": "behavioral",- },- {- "key": "name",- "value": "special",- "type": "person",- }, # this is NOT pushed down- ],- },- {- "type": "AND",- "values": [- {- "key": action1.pk,- "event_type": "actions",- "time_value": 2,- "time_interval": "week",- "value": "performed_event_first_time",- "type": "behavioral",- },- {- "key": "email",- "value": "[email protected]",- "type": "person",- }, # this is pushed down- ],- },- ],- }+ {+ "type": "AND",+ "values": [+ {+ "type": "OR",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 1,+ "time_interval": "day",+ "value": "performed_event",+ "type": "behavioral",+ },+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 2,+ "time_interval": "week",+ "value": "performed_event",+ "type": "behavioral",+ },+ {+ "key": "name",+ "value": "special",+ "type": "person",+ }, # this is NOT pushed down+ ],+ },+ {+ "type": "AND",+ "values": [+ {+ "key": action1.pk,+ "event_type": "actions",+ "time_value": 2,+ "time_interval": "week",+ "value": "performed_event_first_time",+ "type": "behavioral",+ },+ {+ "key": "email",+ "value": "[email protected]",+ "type": "person",+ }, # this is pushed down+ ],+ },+ ],})@@ -1508,25 +1460,23 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):properties={"name": "test", "$sample_field": "[email protected]"},)filter = _properties(- data={- "properties": {- "type": "OR",- "values": [- {- "key": "$pageview",- "event_type": "events",- "time_value": 1,- "time_interval": "week",- "value": "performed_event",- "type": "behavioral",- },- {- "key": "$sample_field",- "value": "[email protected]",- "type": "person",- },- ],- }+ {+ "type": "OR",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event",+ "type": "behavioral",+ },+ {+ "key": "$sample_field",+ "value": "[email protected]",+ "type": "person",+ },+ ],})flush_persons_and_events()@@ -1564,21 +1514,19 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "time_value": 1,- "time_interval": "week",- "value": "performed_event",- "type": "behavioral",- "negation": True,- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event",+ "type": "behavioral",+ "negation": True,+ }+ ],})@@ -1627,30 +1575,28 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "type": "behavioral",- "value": "performed_event",- "negation": True,- "event_type": "events",- "time_value": "30",- "time_interval": "day",- },- {- "key": "$feature_flag_called",- "type": "behavioral",- "value": "performed_event",- "negation": False,- "event_type": "events",- "time_value": "30",- "time_interval": "day",- },- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "type": "behavioral",+ "value": "performed_event",+ "negation": True,+ "event_type": "events",+ "time_value": "30",+ "time_interval": "day",+ },+ {+ "key": "$feature_flag_called",+ "type": "behavioral",+ "value": "performed_event",+ "negation": False,+ "event_type": "events",+ "time_value": "30",+ "time_interval": "day",+ },+ ],},team=self.team,)@@ -1726,36 +1672,34 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):_create_event(team=self.team,event="$new_view",- properties={},- distinct_id="p4",- timestamp=datetime.now() - timedelta(days=4),- )- flush_persons_and_events()-- filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$new_view",- "event_type": "events",- "time_value": 1,- "time_interval": "week",- "value": "performed_event",- "type": "behavioral",- },- {- "key": "$pageview",- "event_type": "events",- "time_value": 2,- "time_interval": "week",- "value": "performed_event",- "type": "behavioral",- "negation": True,- },- ],- }+ properties={},+ distinct_id="p4",+ timestamp=datetime.now() - timedelta(days=4),+ )+ flush_persons_and_events()++ filter = _properties(+ {+ "type": "AND",+ "values": [+ {+ "key": "$new_view",+ "event_type": "events",+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event",+ "type": "behavioral",+ },+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 2,+ "time_interval": "week",+ "value": "performed_event",+ "type": "behavioral",+ "negation": True,+ },+ ],})@@ -1869,33 +1813,31 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$new_view",- "event_type": "events",- "time_value": 1,- "time_interval": "week",- "value": "performed_event",- "type": "behavioral",- },- {- "key": "$pageview",- "event_type": "events",- "time_interval": "day",- "time_value": 8,- "seq_time_interval": "day",- "seq_time_value": 3,- "seq_event": "$pageview",- "seq_event_type": "events",- "value": "performed_event_sequence",- "type": "behavioral",- "negation": True,- },- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$new_view",+ "event_type": "events",+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event",+ "type": "behavioral",+ },+ {+ "key": "$pageview",+ "event_type": "events",+ "time_interval": "day",+ "time_value": 8,+ "seq_time_interval": "day",+ "seq_time_value": 3,+ "seq_event": "$pageview",+ "seq_event_type": "events",+ "value": "performed_event_sequence",+ "type": "behavioral",+ "negation": True,+ },+ ],})@@ -1918,11 +1860,9 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):cohort.calculate_people_ch(pending_version=0)filter = _properties(- data={- "properties": {- "type": "AND",- "values": [{"key": "id", "value": cohort.pk, "type": "cohort"}],- }+ {+ "type": "AND",+ "values": [{"key": "id", "value": cohort.pk, "type": "cohort"}],})@@ -2055,17 +1995,15 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "OR",- "values": [- {- "key": "id",- "value": cohort.pk,- "type": "precalculated-cohort",- }- ],- }+ {+ "type": "OR",+ "values": [+ {+ "key": "id",+ "value": cohort.pk,+ "type": "precalculated-cohort",+ }+ ],})@@ -2091,18 +2029,16 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "OR",- "values": [- {- "key": "id",- "value": cohort.pk,- "type": "precalculated-cohort",- },- {"key": "name", "value": "test2", "type": "person"},- ],- }+ {+ "type": "OR",+ "values": [+ {+ "key": "id",+ "value": cohort.pk,+ "type": "precalculated-cohort",+ },+ {"key": "name", "value": "test2", "type": "person"},+ ],})@@ -2141,21 +2077,19 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {"key": "id", "value": cohort.pk, "type": "cohort"},- {- "key": "$pageview",- "event_type": "events",- "time_value": 1,- "time_interval": "week",- "value": "performed_event",- "type": "behavioral",- },- ],- }+ {+ "type": "AND",+ "values": [+ {"key": "id", "value": cohort.pk, "type": "cohort"},+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event",+ "type": "behavioral",+ },+ ],})@@ -2170,21 +2104,19 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):assert {p2.uuid} == {r[0] for r in res}filter = _properties(- data={- "properties": {- "type": "OR",- "values": [- {"key": "id", "value": cohort.pk, "type": "cohort"},- {- "key": "$pageview",- "event_type": "events",- "time_value": 1,- "time_interval": "week",- "value": "performed_event",- "type": "behavioral",- },- ],- }+ {+ "type": "OR",+ "values": [+ {"key": "id", "value": cohort.pk, "type": "cohort"},+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event",+ "type": "behavioral",+ },+ ],},team=self.team,)@@ -2257,25 +2189,23 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):)filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {"key": "id", "value": cohort.pk, "type": "cohort"},- {- "key": "$new_view",- "event_type": "events",- "time_interval": "day",- "time_value": 8,- "seq_time_interval": "day",- "seq_time_value": 8,- "seq_event": "$new_view",- "seq_event_type": "events",- "value": "performed_event_sequence",- "type": "behavioral",- },- ],- }+ {+ "type": "AND",+ "values": [+ {"key": "id", "value": cohort.pk, "type": "cohort"},+ {+ "key": "$new_view",+ "event_type": "events",+ "time_interval": "day",+ "time_value": 8,+ "seq_time_interval": "day",+ "seq_time_value": 8,+ "seq_event": "$new_view",+ "seq_event_type": "events",+ "value": "performed_event_sequence",+ "type": "behavioral",+ },+ ],})@@ -2295,11 +2225,9 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):cohort.insert_users_by_list(["p1"])filter = _properties(- data={- "properties": {- "type": "OR",- "values": [{"key": "id", "value": cohort.pk, "type": "static-cohort"}],- }+ {+ "type": "OR",+ "values": [{"key": "id", "value": cohort.pk, "type": "static-cohort"}],})@@ -2331,21 +2259,19 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):cohort.insert_users_by_list(["p1", "p2"])filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {"key": "id", "value": cohort.pk, "type": "cohort"},- {- "key": "$pageview",- "event_type": "events",- "time_value": 1,- "time_interval": "week",- "value": "performed_event",- "type": "behavioral",- },- ],- }+ {+ "type": "AND",+ "values": [+ {"key": "id", "value": cohort.pk, "type": "cohort"},+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event",+ "type": "behavioral",+ },+ ],})@@ -2354,21 +2280,19 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):assert [p2.uuid] == [r[0] for r in res]filter = _properties(- data={- "properties": {- "type": "OR",- "values": [- {"key": "id", "value": cohort.pk, "type": "cohort"},- {- "key": "$pageview",- "event_type": "events",- "time_value": 1,- "time_interval": "week",- "value": "performed_event",- "type": "behavioral",- },- ],- }+ {+ "type": "OR",+ "values": [+ {"key": "id", "value": cohort.pk, "type": "cohort"},+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event",+ "type": "behavioral",+ },+ ],},team=self.team,)@@ -2413,23 +2337,21 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- **time_bound,- "seq_time_interval": "day",- "seq_time_value": 3,- "seq_event": "$pageview",- "seq_event_type": "events",- "value": "performed_event_sequence",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ **time_bound,+ "seq_time_interval": "day",+ "seq_time_value": 3,+ "seq_event": "$pageview",+ "seq_event_type": "events",+ "value": "performed_event_sequence",+ "type": "behavioral",+ }+ ],})@@ -2481,24 +2403,22 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": action1.pk,- "event_type": "actions",- "time_interval": "day",- "time_value": 7,- "seq_time_interval": "day",- "seq_time_value": 3,- "seq_event": action1.pk,- "seq_event_type": "actions",- "value": "performed_event_sequence",- "type": "behavioral",- }- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": action1.pk,+ "event_type": "actions",+ "time_interval": "day",+ "time_value": 7,+ "seq_time_interval": "day",+ "seq_time_value": 3,+ "seq_event": action1.pk,+ "seq_event_type": "actions",+ "value": "performed_event_sequence",+ "type": "behavioral",+ }+ ],})@@ -2533,39 +2453,37 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):event="$new_view",properties={},distinct_id="p2",- timestamp=datetime.now() - timedelta(days=5),- )- flush_persons_and_events()-- filter = _properties(- data={- "properties": {- "type": "OR",- "values": [- {- "key": "$pageview",- "event_type": "events",- "time_interval": "day",- "time_value": 7,- "seq_time_interval": "day",- "seq_time_value": 3,- "seq_event": "$pageview",- "seq_event_type": "events",- "value": "performed_event_sequence",- "type": "behavioral",- },- {- "key": "$new_view",- "event_type": "events",- "time_value": 2,- "time_interval": "week",- "seq_time_value": 1,- "seq_time_interval": "week",- "value": "restarted_performing_event",- "type": "behavioral",- },- ],- }+ timestamp=datetime.now() - timedelta(days=5),+ )+ flush_persons_and_events()++ filter = _properties(+ {+ "type": "OR",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "time_interval": "day",+ "time_value": 7,+ "seq_time_interval": "day",+ "seq_time_value": 3,+ "seq_event": "$pageview",+ "seq_event_type": "events",+ "value": "performed_event_sequence",+ "type": "behavioral",+ },+ {+ "key": "$new_view",+ "event_type": "events",+ "time_value": 2,+ "time_interval": "week",+ "seq_time_value": 1,+ "seq_time_interval": "week",+ "value": "restarted_performing_event",+ "type": "behavioral",+ },+ ],})@@ -2614,34 +2532,32 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "time_interval": "day",- "time_value": 7,- "seq_time_interval": "day",- "seq_time_value": 3,- "seq_event": "$pageview",- "seq_event_type": "events",- "value": "performed_event_sequence",- "type": "behavioral",- },- {- "key": "$pageview",- "event_type": "events",- "operator": "gte",- "operator_value": 1,- "time_value": 1,- "time_interval": "week",- "value": "performed_event_multiple",- "type": "behavioral",- },- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "time_interval": "day",+ "time_value": 7,+ "seq_time_interval": "day",+ "seq_time_value": 3,+ "seq_event": "$pageview",+ "seq_event_type": "events",+ "value": "performed_event_sequence",+ "type": "behavioral",+ },+ {+ "key": "$pageview",+ "event_type": "events",+ "operator": "gte",+ "operator_value": 1,+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event_multiple",+ "type": "behavioral",+ },+ ],})@@ -2716,39 +2632,37 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "time_interval": "day",- "time_value": 7,- "seq_time_interval": "day",- "seq_time_value": 3,- "seq_event": "$pageview",- "seq_event_type": "events",- "value": "performed_event_sequence",- "type": "behavioral",- },- {- "key": "$pageview",- "event_type": "events",- "operator": "gte",- "operator_value": 1,- "time_value": 1,- "time_interval": "week",- "value": "performed_event_multiple",- "type": "behavioral",- },- {- "key": "email",- "value": "[email protected]",- "type": "person",- }, # pushed down- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "time_interval": "day",+ "time_value": 7,+ "seq_time_interval": "day",+ "seq_time_value": 3,+ "seq_event": "$pageview",+ "seq_event_type": "events",+ "value": "performed_event_sequence",+ "type": "behavioral",+ },+ {+ "key": "$pageview",+ "event_type": "events",+ "operator": "gte",+ "operator_value": 1,+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event_multiple",+ "type": "behavioral",+ },+ {+ "key": "email",+ "value": "[email protected]",+ "type": "person",+ }, # pushed down+ ],})@@ -2805,36 +2719,34 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "AND",- "values": [- {- "key": "$pageview",- "event_type": "events",- "time_interval": "day",- "time_value": 7,- "seq_time_interval": "day",- "seq_time_value": 3,- "seq_event": "$pageview",- "seq_event_type": "events",- "value": "performed_event_sequence",- "type": "behavioral",- },- {- "key": "$pageview",- "event_type": "events",- "time_interval": "week",- "time_value": 2,- "seq_time_interval": "day",- "seq_time_value": 2,- "seq_event": "$new_view",- "seq_event_type": "events",- "value": "performed_event_sequence",- "type": "behavioral",- },- ],- }+ {+ "type": "AND",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "time_interval": "day",+ "time_value": 7,+ "seq_time_interval": "day",+ "seq_time_value": 3,+ "seq_event": "$pageview",+ "seq_event_type": "events",+ "value": "performed_event_sequence",+ "type": "behavioral",+ },+ {+ "key": "$pageview",+ "event_type": "events",+ "time_interval": "week",+ "time_value": 2,+ "seq_time_interval": "day",+ "seq_time_value": 2,+ "seq_event": "$new_view",+ "seq_event_type": "events",+ "value": "performed_event_sequence",+ "type": "behavioral",+ },+ ],})@@ -2882,34 +2794,32 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):flush_persons_and_events()filter = _properties(- data={- "properties": {- "type": "OR",- "values": [- {- "key": "$pageview",- "event_type": "events",- "time_interval": "day",- "time_value": 7,- "seq_time_interval": "day",- "seq_time_value": 3,- "seq_event": "$pageview",- "seq_event_type": "events",- "value": "performed_event_sequence",- "type": "behavioral",- },- {- "key": "$new_view",- "event_type": "events",- "operator": "gte",- "operator_value": 1,- "time_value": 1,- "time_interval": "week",- "value": "performed_event_multiple",- "type": "behavioral",- },- ],- }+ {+ "type": "OR",+ "values": [+ {+ "key": "$pageview",+ "event_type": "events",+ "time_interval": "day",+ "time_value": 7,+ "seq_time_interval": "day",+ "seq_time_value": 3,+ "seq_event": "$pageview",+ "seq_event_type": "events",+ "value": "performed_event_sequence",+ "type": "behavioral",+ },+ {+ "key": "$new_view",+ "event_type": "events",+ "operator": "gte",+ "operator_value": 1,+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event_multiple",+ "type": "behavioral",+ },+ ],})res = execute(filter, self.team)@@ -2988,26 +2898,24 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):)filter = _properties(- data={- "properties": {- "type": "OR",- "values": [- {- "key": "id",- "value": other_cohort.pk,- "type": "cohort",- }, # p3 fits in here- {- "key": "$pageview",- "event_type": "events",- "time_value": 1,- "time_interval": "week",- "value": "performed_event",- "type": "behavioral",- # p2 fits in here- },- ],- }+ {+ "type": "OR",+ "values": [+ {+ "key": "id",+ "value": other_cohort.pk,+ "type": "cohort",+ }, # p3 fits in here+ {+ "key": "$pageview",+ "event_type": "events",+ "time_value": 1,+ "time_interval": "week",+ "value": "performed_event",+ "type": "behavioral",+ # p2 fits in here+ },+ ],})@@ -3120,11 +3028,9 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):)filter = _properties(- data={- "properties": {- "type": "OR",- "values": [{"key": "id", "value": cohort2.pk, "type": "cohort"}], # p3 fits in here- }+ {+ "type": "OR",+ "values": [{"key": "id", "value": cohort2.pk, "type": "cohort"}], # p3 fits in here},team=self.team,)@@ -3273,11 +3179,9 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):)filter = _properties(- data={- "properties": {- "type": "OR",- "values": [{"key": "id", "value": cohort3.pk, "type": "cohort"}],- }+ {+ "type": "OR",+ "values": [{"key": "id", "value": cohort3.pk, "type": "cohort"}],},team=self.team,)@@ -3375,30 +3279,28 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):# "Application Opened" gte 2 times per 1 year for at least 2 of the last 2 yearsfilter = _properties(- data={- "properties": {- "type": "OR",- "values": [- {- "type": "OR",- "values": [- {- "key": "Application Opened",- "type": "behavioral",- "value": "performed_event_regularly",- "negation": False,- "operator": "gte",- "event_type": "events",- "time_value": 1,- "min_periods": 2,- "time_interval": "year",- "total_periods": 2,- "operator_value": 2,- }- ],- }- ],- }+ {+ "type": "OR",+ "values": [+ {+ "type": "OR",+ "values": [+ {+ "key": "Application Opened",+ "type": "behavioral",+ "value": "performed_event_regularly",+ "negation": False,+ "operator": "gte",+ "event_type": "events",+ "time_value": 1,+ "min_periods": 2,+ "time_interval": "year",+ "total_periods": 2,+ "operator_value": 2,+ }+ ],+ }+ ],})@@ -3457,11 +3359,9 @@ class TestCohortQuery(ClickhouseTestMixin, BaseTest):# Create filter using the cohortfilter = _properties(- data={- "properties": {- "type": "OR",- "values": [{"key": "id", "value": cohort.pk, "type": "cohort"}],- }+ {+ "type": "OR",+ "values": [{"key": "id", "value": cohort.pk, "type": "cohort"}],},team=self.team,)@@ -3518,11 +3418,9 @@ class TestCohortNegationValidation(BaseTest):)filter = _properties(- data={- "properties": {- "type": "OR",- "values": [{"key": "id", "value": cohort.pk, "type": "cohort"}],- }+ {+ "type": "OR",+ "values": [{"key": "id", "value": cohort.pk, "type": "cohort"}],},team=self.team,)@@ -3585,23 +3483,21 @@ class TestCohortNegationValidation(BaseTest):},)- filter_data = {- "properties": {- "type": "OR",- "values": [{"key": "id", "value": cohort.pk, "type": "cohort"}],- }+ properties = {+ "type": "OR",+ "values": [{"key": "id", "value": cohort.pk, "type": "cohort"}],}cohort_query1 = CohortQuery(property_groups=_properties(- data=filter_data,+ properties,team=self.team,),team=self.team,)cohort_query2 = CohortQuery(property_groups=_properties(- data=filter_data,+ properties,team=other_team,),team=other_team,diff --git a/posthog/constants.py b/posthog/constants.pyindex c6c58debdb24..9807591cad0d 100644--- a/posthog/constants.py+++ b/posthog/constants.py@@ -69,13 +69,10 @@ TREND_FILTER_TYPE_EVENTS = "events"TREND_FILTER_TYPE_DATA_WAREHOUSE = "data_warehouse"TRENDS_CUMULATIVE = "ActionsLineGraphCumulative"-TRENDS_LINEAR = "ActionsLineGraph"TRENDS_TABLE = "ActionsTable"-TRENDS_FUNNEL = "FunnelViz"TRENDS_PIE = "ActionsPie"TRENDS_DONUT = "ActionsDonut"TRENDS_PROPORTION_BAR = "ActionsProportionBar"-TRENDS_PATHS = "PathsViz"TRENDS_BAR = "ActionsBar"TRENDS_BAR_VALUE = "ActionsBarValue"TRENDS_WORLD_MAP = "WorldMap"@@ -99,38 +96,7 @@ NON_TIME_SERIES_DISPLAY_TYPES = [NON_BREAKDOWN_DISPLAY_TYPES = [TRENDS_BOLD_NUMBER, TRENDS_METRIC, TRENDS_CALENDAR_HEATMAP, TRENDS_BOX_PLOT]# CONSTANTS-INSIGHT_TRENDS = "TRENDS"-INSIGHT_STICKINESS = "STICKINESS"-INSIGHT_LIFECYCLE = "LIFECYCLE"INSIGHT_FUNNELS = "FUNNELS"-INSIGHT_PATHS = "PATHS"-INSIGHT_RETENTION = "RETENTION"--INSIGHT_TO_DISPLAY = {- INSIGHT_TRENDS: TRENDS_LINEAR,- INSIGHT_STICKINESS: TRENDS_LINEAR,- INSIGHT_LIFECYCLE: TRENDS_LINEAR,- INSIGHT_FUNNELS: TRENDS_FUNNEL,- INSIGHT_PATHS: TRENDS_PATHS,- INSIGHT_RETENTION: TRENDS_TABLE,- # :KLUDGE: Sessions insight is no longer supported, but this is needed to make updating these insights possible.- "SESSIONS": TRENDS_LINEAR,-}--DISPLAY_TYPES = Literal[- "ActionsLineGraph",- "ActionsLineGraphCumulative",- "ActionsTable",- "ActionsPie",- "ActionsDonut",- "ActionsProportionBar",- "ActionsBar",- "ActionsBarValue",- "WorldMap",- "BoldNumber",- "Metric",- "CalendarHeatmap",-]DEPRECATED_DISPLAY_TYPES = Literal["PathsViz",@@ -148,9 +114,6 @@ CUSTOM_EVENT = "custom_event"HOGQL = "hogql"-DATE_FROM = "date_from"-DATE_TO = "date_to"-EXPLICIT_DATE = "explicit_date"ENTITIES = "entities"ACTIONS = "actions"EVENTS = "events"@@ -159,21 +122,13 @@ EXCLUSIONS = "exclusions"PROPERTIES = "properties"PROPERTY_GROUPS = "property_groups"INTERVAL = "interval"-DISPLAY = "display"SHOWN_AS = "shown_as"CLIENT_QUERY_ID = "client_query_id"FILTER_TEST_ACCOUNTS = "filter_test_accounts"-BREAKDOWN_TYPE = "breakdown_type"-BREAKDOWN_GROUP_TYPE_INDEX = "breakdown_group_type_index"COMPARE = "compare"COMPARE_TO = "compare_to"INSIGHT = "insight"SESSION = "session"-BREAKDOWN = "breakdown"-BREAKDOWNS = "breakdowns"-BREAKDOWN_ATTRIBUTION_TYPE = "breakdown_attribution_type"-BREAKDOWN_ATTRIBUTION_VALUE = "breakdown_attribution_value"-BREAKDOWN_LIMIT = "breakdown_limit"FROM_DASHBOARD = "from_dashboard"PATH_TYPE = "path_type"RETENTION_TYPE = "retention_type"@@ -216,9 +171,6 @@ PATH_EDGE_LIMIT = "edge_limit"PATH_MIN_EDGE_WEIGHT = "min_edge_weight"PATH_MAX_EDGE_WEIGHT = "max_edge_weight"AGGREGATION_GROUP_TYPE_INDEX = "aggregation_group_type_index"-BREAKDOWN_HISTOGRAM_BIN_COUNT = "breakdown_histogram_bin_count"-BREAKDOWN_HIDE_OTHER_AGGREGATION = "breakdown_hide_other_aggregation"-BREAKDOWN_NORMALIZE_URL = "breakdown_normalize_url"SAMPLING_FACTOR = "sampling_factor"diff --git a/posthog/models/filters/test/__snapshots__/test_filter.ambr b/posthog/models/filters/test/__snapshots__/test_filter.ambrdeleted file mode 100644index c294bc32c7b2..000000000000--- a/posthog/models/filters/test/__snapshots__/test_filter.ambr+++ /dev/null@@ -1,361 +0,0 @@-# serializer version: 1-# name: TestDjangoPropertyGroupToQ.test_property_group_to_q_with_cohorts- '''- SELECT "posthog_filesystem"."team_id",- "posthog_filesystem"."id",- "posthog_filesystem"."path",- "posthog_filesystem"."depth",- "posthog_filesystem"."type",- "posthog_filesystem"."ref",- "posthog_filesystem"."href",- "posthog_filesystem"."shortcut",- "posthog_filesystem"."meta",- "posthog_filesystem"."created_at",- "posthog_filesystem"."created_by_id",- "posthog_filesystem"."surface",- "posthog_filesystem"."project_id"- FROM "posthog_filesystem"- WHERE (("posthog_filesystem"."surface" IS NULL- OR "posthog_filesystem"."surface" = 'web')- AND "posthog_filesystem"."ref" = '0001'- AND "posthog_filesystem"."team_id" = 99999- AND "posthog_filesystem"."type" = 'cohort'- AND NOT ("posthog_filesystem"."shortcut"- AND "posthog_filesystem"."shortcut" IS NOT NULL))- '''-# ----# name: TestDjangoPropertyGroupToQ.test_property_group_to_q_with_cohorts.1- '''- SELECT "posthog_cohort"."id",- "posthog_cohort"."name",- "posthog_cohort"."description",- "posthog_cohort"."team_id",- "posthog_cohort"."deleted",- "posthog_cohort"."filters",- "posthog_cohort"."query",- "posthog_cohort"."version",- "posthog_cohort"."pending_version",- "posthog_cohort"."count",- "posthog_cohort"."created_by_id",- "posthog_cohort"."created_at",- "posthog_cohort"."is_calculating",- "posthog_cohort"."last_calculation",- "posthog_cohort"."last_calculation_duration_ms",- "posthog_cohort"."errors_calculating",- "posthog_cohort"."last_error_at",- "posthog_cohort"."last_backfill_person_properties_at",- "posthog_cohort"."last_backfill_events_at",- "posthog_cohort"."last_realtime_cohort_calculation_at",- "posthog_cohort"."is_static",- "posthog_cohort"."kind",- "posthog_cohort"."cohort_type",- "posthog_cohort"."groups"- FROM "posthog_cohort"- INNER JOIN "posthog_team" ON ("posthog_cohort"."team_id" = "posthog_team"."id")- WHERE (NOT "posthog_cohort"."deleted"- AND "posthog_cohort"."id" = 99999- AND "posthog_team"."project_id" = 99999)- ORDER BY "posthog_cohort"."id" ASC- LIMIT 1- '''-# ----# name: TestDjangoPropertyGroupToQ.test_property_group_to_q_with_cohorts_no_match- '''- SELECT "posthog_filesystem"."team_id",- "posthog_filesystem"."id",- "posthog_filesystem"."path",- "posthog_filesystem"."depth",- "posthog_filesystem"."type",- "posthog_filesystem"."ref",- "posthog_filesystem"."href",- "posthog_filesystem"."shortcut",- "posthog_filesystem"."meta",- "posthog_filesystem"."created_at",- "posthog_filesystem"."created_by_id",- "posthog_filesystem"."surface",- "posthog_filesystem"."project_id"- FROM "posthog_filesystem"- WHERE (("posthog_filesystem"."surface" IS NULL- OR "posthog_filesystem"."surface" = 'web')- AND "posthog_filesystem"."ref" = '0001'- AND "posthog_filesystem"."team_id" = 99999- AND "posthog_filesystem"."type" = 'cohort'- AND NOT ("posthog_filesystem"."shortcut"- AND "posthog_filesystem"."shortcut" IS NOT NULL))- '''-# ----# name: TestDjangoPropertyGroupToQ.test_property_group_to_q_with_cohorts_no_match.1- '''- SELECT "posthog_cohort"."id",- "posthog_cohort"."name",- "posthog_cohort"."description",- "posthog_cohort"."team_id",- "posthog_cohort"."deleted",- "posthog_cohort"."filters",- "posthog_cohort"."query",- "posthog_cohort"."version",- "posthog_cohort"."pending_version",- "posthog_cohort"."count",- "posthog_cohort"."created_by_id",- "posthog_cohort"."created_at",- "posthog_cohort"."is_calculating",- "posthog_cohort"."last_calculation",- "posthog_cohort"."last_calculation_duration_ms",- "posthog_cohort"."errors_calculating",- "posthog_cohort"."last_error_at",- "posthog_cohort"."last_backfill_person_properties_at",- "posthog_cohort"."last_backfill_events_at",- "posthog_cohort"."last_realtime_cohort_calculation_at",- "posthog_cohort"."is_static",- "posthog_cohort"."kind",- "posthog_cohort"."cohort_type",- "posthog_cohort"."groups"- FROM "posthog_cohort"- INNER JOIN "posthog_team" ON ("posthog_cohort"."team_id" = "posthog_team"."id")- WHERE (NOT "posthog_cohort"."deleted"- AND "posthog_cohort"."id" = 99999- AND "posthog_team"."project_id" = 99999)- ORDER BY "posthog_cohort"."id" ASC- LIMIT 1- '''-# ----# name: TestDjangoPropertyGroupToQ.test_property_group_to_q_with_negation_cohorts- '''- SELECT "posthog_filesystem"."team_id",- "posthog_filesystem"."id",- "posthog_filesystem"."path",- "posthog_filesystem"."depth",- "posthog_filesystem"."type",- "posthog_filesystem"."ref",- "posthog_filesystem"."href",- "posthog_filesystem"."shortcut",- "posthog_filesystem"."meta",- "posthog_filesystem"."created_at",- "posthog_filesystem"."created_by_id",- "posthog_filesystem"."surface",- "posthog_filesystem"."project_id"- FROM "posthog_filesystem"- WHERE (("posthog_filesystem"."surface" IS NULL- OR "posthog_filesystem"."surface" = 'web')- AND "posthog_filesystem"."ref" = '0001'- AND "posthog_filesystem"."team_id" = 99999- AND "posthog_filesystem"."type" = 'cohort'- AND NOT ("posthog_filesystem"."shortcut"- AND "posthog_filesystem"."shortcut" IS NOT NULL))- '''-# ----# name: TestDjangoPropertyGroupToQ.test_property_group_to_q_with_negation_cohorts.1- '''- SELECT "posthog_filesystem"."team_id",- "posthog_filesystem"."id",- "posthog_filesystem"."path",- "posthog_filesystem"."depth",- "posthog_filesystem"."type",- "posthog_filesystem"."ref",- "posthog_filesystem"."href",- "posthog_filesystem"."shortcut",- "posthog_filesystem"."meta",- "posthog_filesystem"."created_at",- "posthog_filesystem"."created_by_id",- "posthog_filesystem"."surface",- "posthog_filesystem"."project_id"- FROM "posthog_filesystem"- WHERE (("posthog_filesystem"."surface" IS NULL- OR "posthog_filesystem"."surface" = 'web')- AND "posthog_filesystem"."ref" = '0001'- AND "posthog_filesystem"."team_id" = 99999- AND "posthog_filesystem"."type" = 'cohort'- AND NOT ("posthog_filesystem"."shortcut"- AND "posthog_filesystem"."shortcut" IS NOT NULL))- '''-# ----# name: TestDjangoPropertyGroupToQ.test_property_group_to_q_with_negation_cohorts.2- '''- SELECT "posthog_filesystem"."team_id",- "posthog_filesystem"."id",- "posthog_filesystem"."path",- "posthog_filesystem"."depth",- "posthog_filesystem"."type",- "posthog_filesystem"."ref",- "posthog_filesystem"."href",- "posthog_filesystem"."shortcut",- "posthog_filesystem"."meta",- "posthog_filesystem"."created_at",- "posthog_filesystem"."created_by_id",- "posthog_filesystem"."surface",- "posthog_filesystem"."project_id"- FROM "posthog_filesystem"- WHERE (("posthog_filesystem"."surface" IS NULL- OR "posthog_filesystem"."surface" = 'web')- AND "posthog_filesystem"."ref" = '0001'- AND "posthog_filesystem"."team_id" = 99999- AND "posthog_filesystem"."type" = 'cohort'- AND NOT ("posthog_filesystem"."shortcut"- AND "posthog_filesystem"."shortcut" IS NOT NULL))- '''-# ----# name: TestDjangoPropertyGroupToQ.test_property_group_to_q_with_negation_cohorts.3- '''- SELECT "posthog_filesystem"."team_id",- "posthog_filesystem"."id",- "posthog_filesystem"."path",- "posthog_filesystem"."depth",- "posthog_filesystem"."type",- "posthog_filesystem"."ref",- "posthog_filesystem"."href",- "posthog_filesystem"."shortcut",- "posthog_filesystem"."meta",- "posthog_filesystem"."created_at",- "posthog_filesystem"."created_by_id",- "posthog_filesystem"."surface",- "posthog_filesystem"."project_id"- FROM "posthog_filesystem"- WHERE (("posthog_filesystem"."surface" IS NULL- OR "posthog_filesystem"."surface" = 'web')- AND "posthog_filesystem"."ref" = '0001'- AND "posthog_filesystem"."team_id" = 99999- AND "posthog_filesystem"."type" = 'cohort'- AND NOT ("posthog_filesystem"."shortcut"- AND "posthog_filesystem"."shortcut" IS NOT NULL))- '''-# ----# name: TestDjangoPropertyGroupToQ.test_property_group_to_q_with_negation_cohorts.4- '''- SELECT "posthog_cohort"."id",- "posthog_cohort"."name",- "posthog_cohort"."description",- "posthog_cohort"."team_id",- "posthog_cohort"."deleted",- "posthog_cohort"."filters",- "posthog_cohort"."query",- "posthog_cohort"."version",- "posthog_cohort"."pending_version",- "posthog_cohort"."count",- "posthog_cohort"."created_by_id",- "posthog_cohort"."created_at",- "posthog_cohort"."is_calculating",- "posthog_cohort"."last_calculation",- "posthog_cohort"."last_calculation_duration_ms",- "posthog_cohort"."errors_calculating",- "posthog_cohort"."last_error_at",- "posthog_cohort"."last_backfill_person_properties_at",- "posthog_cohort"."last_backfill_events_at",- "posthog_cohort"."last_realtime_cohort_calculation_at",- "posthog_cohort"."is_static",- "posthog_cohort"."kind",- "posthog_cohort"."cohort_type",- "posthog_cohort"."groups"- FROM "posthog_cohort"- INNER JOIN "posthog_team" ON ("posthog_cohort"."team_id" = "posthog_team"."id")- WHERE (NOT "posthog_cohort"."deleted"- AND "posthog_cohort"."id" = 99999- AND "posthog_team"."project_id" = 99999)- ORDER BY "posthog_cohort"."id" ASC- LIMIT 1- '''-# ----# name: TestDjangoPropertyGroupToQ.test_property_group_to_q_with_negation_cohorts.5- '''- SELECT "posthog_cohort"."id",- "posthog_cohort"."name",- "posthog_cohort"."description",- "posthog_cohort"."team_id",- "posthog_cohort"."deleted",- "posthog_cohort"."filters",- "posthog_cohort"."query",- "posthog_cohort"."version",- "posthog_cohort"."pending_version",- "posthog_cohort"."count",- "posthog_cohort"."created_by_id",- "posthog_cohort"."created_at",- "posthog_cohort"."is_calculating",- "posthog_cohort"."last_calculation",- "posthog_cohort"."last_calculation_duration_ms",- "posthog_cohort"."errors_calculating",- "posthog_cohort"."last_error_at",- "posthog_cohort"."last_backfill_person_properties_at",- "posthog_cohort"."last_backfill_events_at",- "posthog_cohort"."last_realtime_cohort_calculation_at",- "posthog_cohort"."is_static",- "posthog_cohort"."kind",- "posthog_cohort"."cohort_type",- "posthog_cohort"."groups"- FROM "posthog_cohort"- INNER JOIN "posthog_team" ON ("posthog_cohort"."team_id" = "posthog_team"."id")- WHERE (NOT "posthog_cohort"."deleted"- AND "posthog_cohort"."id" = 99999- AND "posthog_team"."project_id" = 99999)- ORDER BY "posthog_cohort"."id" ASC- LIMIT 1- '''-# ----# name: TestDjangoPropertyGroupToQ.test_property_group_to_q_with_negation_cohorts.6- '''- SELECT "posthog_cohort"."id",- "posthog_cohort"."name",- "posthog_cohort"."description",- "posthog_cohort"."team_id",- "posthog_cohort"."deleted",- "posthog_cohort"."filters",- "posthog_cohort"."query",- "posthog_cohort"."version",- "posthog_cohort"."pending_version",- "posthog_cohort"."count",- "posthog_cohort"."created_by_id",- "posthog_cohort"."created_at",- "posthog_cohort"."is_calculating",- "posthog_cohort"."last_calculation",- "posthog_cohort"."last_calculation_duration_ms",- "posthog_cohort"."errors_calculating",- "posthog_cohort"."last_error_at",- "posthog_cohort"."last_backfill_person_properties_at",- "posthog_cohort"."last_backfill_events_at",- "posthog_cohort"."last_realtime_cohort_calculation_at",- "posthog_cohort"."is_static",- "posthog_cohort"."kind",- "posthog_cohort"."cohort_type",- "posthog_cohort"."groups"- FROM "posthog_cohort"- INNER JOIN "posthog_team" ON ("posthog_cohort"."team_id" = "posthog_team"."id")- WHERE (NOT "posthog_cohort"."deleted"- AND "posthog_cohort"."id" = 99999- AND "posthog_team"."project_id" = 99999)- ORDER BY "posthog_cohort"."id" ASC- LIMIT 1- '''-# ----# name: TestDjangoPropertyGroupToQ.test_property_group_to_q_with_negation_cohorts.7- '''- SELECT "posthog_cohort"."id",- "posthog_cohort"."name",- "posthog_cohort"."description",- "posthog_cohort"."team_id",- "posthog_cohort"."deleted",- "posthog_cohort"."filters",- "posthog_cohort"."query",- "posthog_cohort"."version",- "posthog_cohort"."pending_version",- "posthog_cohort"."count",- "posthog_cohort"."created_by_id",- "posthog_cohort"."created_at",- "posthog_cohort"."is_calculating",- "posthog_cohort"."last_calculation",- "posthog_cohort"."last_calculation_duration_ms",- "posthog_cohort"."errors_calculating",- "posthog_cohort"."last_error_at",- "posthog_cohort"."last_backfill_person_properties_at",- "posthog_cohort"."last_backfill_events_at",- "posthog_cohort"."last_realtime_cohort_calculation_at",- "posthog_cohort"."is_static",- "posthog_cohort"."kind",- "posthog_cohort"."cohort_type",- "posthog_cohort"."groups"- FROM "posthog_cohort"- INNER JOIN "posthog_team" ON ("posthog_cohort"."team_id" = "posthog_team"."id")- WHERE (NOT "posthog_cohort"."deleted"- AND "posthog_cohort"."id" = 99999- AND "posthog_team"."project_id" = 99999)- ORDER BY "posthog_cohort"."id" ASC- LIMIT 1- '''-# ---diff --git a/posthog/models/filters/test/test_filter.py b/posthog/models/property/test/test_parse_property_group_data.pysimilarity index 99%rename from posthog/models/filters/test/test_filter.pyrename to posthog/models/property/test/test_parse_property_group_data.pyindex eba8ed3ac9fc..b5f3d165c4e4 100644--- a/posthog/models/filters/test/test_filter.py+++ b/posthog/models/property/test/test_parse_property_group_data.py@@ -9,7 +9,7 @@ from posthog.models.property.parse import expand_cohort_properties, parse_properfrom products.cohorts.backend.models.cohort import Cohort-class TestFilter(BaseTest):+class TestParsePropertyGroupData(BaseTest):def test_old_style_properties(self):property_groups = parse_property_group_data({"$browser__is_not": "IE7", "$OS": "Mac"})self.assertEqual(cast(Property, property_groups.values[0]).key, "$browser")