diff --git a/mypy-baseline.txt b/mypy-baseline.txt index 2143c119ea5c2..d8231681ce336 100644 --- a/mypy-baseline.txt +++ b/mypy-baseline.txt @@ -468,63 +468,7 @@ posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Need type annotation for "properties_3" (hint: "properties_3: Dict[, ] = ...") [var-annotated] posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Need type annotation for "filter" (hint: "filter: Dict[, ] = ...") [var-annotated] posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Need type annotation for "filter" (hint: "filter: Dict[, ] = ...") [var-annotated] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "None" of "DateRange | None" has no attribute "date_from" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "None" of "DateRange | None" has no attribute "date_to" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "interval" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "interval" [union-attr] posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Need type annotation for "filter" (hint: "filter: Dict[, ] = ...") [var-annotated] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "series" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "series" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "series" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "series" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "series" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "series" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "series" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "series" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "series" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "series" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "breakdownFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "breakdownFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "StickinessQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "breakdownFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "LifecycleQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "breakdownFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "breakdownFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "breakdownFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "StickinessQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "breakdownFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "LifecycleQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "breakdownFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "breakdownFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "breakdownFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "StickinessQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "breakdownFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "LifecycleQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "breakdownFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "FunnelsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "trendsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "trendsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "trendsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "StickinessQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "trendsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "LifecycleQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "trendsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "TrendsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "funnelsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "funnelsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "funnelsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "StickinessQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "funnelsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "LifecycleQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "funnelsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "TrendsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "retentionFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "FunnelsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "retentionFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "retentionFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "StickinessQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "retentionFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "LifecycleQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "retentionFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "TrendsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "pathsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "FunnelsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "pathsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "pathsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "StickinessQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "pathsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "LifecycleQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "pathsFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "TrendsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "stickinessFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "FunnelsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "stickinessFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "stickinessFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "stickinessFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "LifecycleQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "stickinessFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "TrendsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "lifecycleFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "FunnelsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "lifecycleFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "RetentionQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "lifecycleFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "PathsQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "lifecycleFilter" [union-attr] -posthog/hogql_queries/legacy_compatibility/test/test_filter_to_query.py:0: error: Item "StickinessQuery" of "TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery" has no attribute "lifecycleFilter" [union-attr] posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "SelectUnionQuery" of "SelectQuery | SelectUnionQuery" has no attribute "select" [union-attr] posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "SelectUnionQuery" of "SelectQuery | SelectUnionQuery" has no attribute "select" [union-attr] posthog/hogql_queries/insights/trends/test/test_aggregation_operations.py:0: error: Item "SelectUnionQuery" of "SelectQuery | SelectUnionQuery" has no attribute "group_by" [union-attr] diff --git a/posthog/hogql_queries/insights/paths_query_runner.py b/posthog/hogql_queries/insights/paths_query_runner.py index d2c519033aa3d..052fe2a586f47 100644 --- a/posthog/hogql_queries/insights/paths_query_runner.py +++ b/posthog/hogql_queries/insights/paths_query_runner.py @@ -16,6 +16,7 @@ from posthog.hogql.property import property_to_expr from posthog.hogql.query import execute_hogql_query from posthog.hogql.timings import HogQLTimings +from posthog.hogql_queries.insights.funnels.funnels_query_runner import FunnelsQueryRunner from posthog.hogql_queries.insights.funnels.utils import funnel_window_interval_unit_to_sql from posthog.hogql_queries.query_runner import QueryRunner from posthog.hogql_queries.utils.query_date_range import QueryDateRange @@ -204,6 +205,7 @@ def funnel_join(self) -> ast.JoinExpr: limit_context=self.limit_context, ) + assert isinstance(actors_query_runner.source_runner, FunnelsQueryRunner) assert actors_query_runner.source_runner.context is not None actors_query_runner.source_runner.context.includeTimestamp = funnelPathType in ( FunnelPathType.funnel_path_after_step, @@ -530,7 +532,7 @@ def get_session_threshold_clause(self) -> ast.Expr: if funnelSourceFilter.funnelWindowInterval: interval = funnelSourceFilter.funnelWindowInterval unit = funnelSourceFilter.funnelWindowIntervalUnit - interval_unit = funnel_window_interval_unit_to_sql(unit) + interval_unit = funnel_window_interval_unit_to_sql(unit) # type: ignore return parse_expr( f"arraySplit(x -> if(toDateTime('2018-01-01') + toIntervalSecond(_toInt64(x.3)) < toDateTime('2018-01-01') + INTERVAL {interval} {interval_unit}, 0, 1), paths_tuple)" diff --git a/posthog/hogql_queries/legacy_compatibility/filter_to_query.py b/posthog/hogql_queries/legacy_compatibility/filter_to_query.py index aea2ffe5e5227..2714c84db438e 100644 --- a/posthog/hogql_queries/legacy_compatibility/filter_to_query.py +++ b/posthog/hogql_queries/legacy_compatibility/filter_to_query.py @@ -1,7 +1,7 @@ import copy from enum import Enum import json -from typing import List, Dict, Literal +from typing import Any, List, Dict, Literal from posthog.models.entity.entity import Entity as LegacyEntity from posthog.schema import ( ActionsNode, @@ -453,7 +453,7 @@ def _insight_filter(filter: Dict): minEdgeWeight=filter.get("min_edge_weight"), maxEdgeWeight=filter.get("max_edge_weight"), ), - "funnelPathsFilter": filters_to_funnel_paths_query(filter), + "funnelPathsFilter": filters_to_funnel_paths_query(filter), # type: ignore } elif _insight_type(filter) == "LIFECYCLE": insight_filter = { @@ -480,7 +480,7 @@ def _insight_filter(filter: Dict): return insight_filter -def filters_to_funnel_paths_query(filter: Dict) -> FunnelPathsFilter | None: +def filters_to_funnel_paths_query(filter: Dict[str, Any]) -> FunnelPathsFilter | None: funnel_paths = filter.get("funnel_paths") funnel_filter = filter.get("funnel_filter")