From d438806a73c0d044747d3167549f75e649cf21c6 Mon Sep 17 00:00:00 2001 From: Julian Bez Date: Thu, 21 Mar 2024 11:40:33 +0100 Subject: [PATCH] Revert schema change --- frontend/src/queries/schema.json | 9 ++++++++- frontend/src/queries/schema.ts | 2 +- .../insights/insight_actors_query_runner.py | 4 ++-- posthog/schema.py | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json index ad4e3ead688fd..898d4e0974004 100644 --- a/frontend/src/queries/schema.json +++ b/frontend/src/queries/schema.json @@ -2659,7 +2659,14 @@ "type": "string" }, "day": { - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/Day" + } + ] }, "includeRecordings": { "type": "boolean" diff --git a/frontend/src/queries/schema.ts b/frontend/src/queries/schema.ts index ddef219904e99..7eaa1734ea463 100644 --- a/frontend/src/queries/schema.ts +++ b/frontend/src/queries/schema.ts @@ -1091,7 +1091,7 @@ export interface InsightActorsQueryBase { export interface InsightActorsQuery extends InsightActorsQueryBase { kind: NodeKind.InsightActorsQuery source: T - day?: string + day?: string | Day status?: string /** An interval selected out of available intervals in source query. */ interval?: integer diff --git a/posthog/hogql_queries/insights/insight_actors_query_runner.py b/posthog/hogql_queries/insights/insight_actors_query_runner.py index 782dd5b054a0e..a0e38abae1776 100644 --- a/posthog/hogql_queries/insights/insight_actors_query_runner.py +++ b/posthog/hogql_queries/insights/insight_actors_query_runner.py @@ -1,5 +1,5 @@ from datetime import timedelta -from typing import cast +from typing import cast, Optional from posthog.hogql import ast from posthog.hogql.query import execute_hogql_query @@ -37,7 +37,7 @@ def to_query(self) -> ast.SelectQuery | ast.SelectUnionQuery: trends_runner = cast(TrendsQueryRunner, self.source_runner) query = cast(InsightActorsQuery, self.query) return trends_runner.to_actors_query( - time_frame=query.day, + time_frame=cast(Optional[str], query.day), # Other runner accept day as int, but not this one series_index=query.series or 0, breakdown_value=query.breakdown, compare=query.compare, diff --git a/posthog/schema.py b/posthog/schema.py index 14da6ae16e515..dc77da163db17 100644 --- a/posthog/schema.py +++ b/posthog/schema.py @@ -2806,7 +2806,7 @@ class InsightActorsQuery(BaseModel): ) breakdown: Optional[Union[str, int]] = None compare: Optional[Compare] = None - day: Optional[str] = None + day: Optional[Union[str, int]] = None includeRecordings: Optional[bool] = None interval: Optional[int] = Field( default=None, description="An interval selected out of available intervals in source query."