diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml index 1a8f18b4a8abe..cec3a83798abc 100644 --- a/.github/workflows/ci-backend.yml +++ b/.github/workflows/ci-backend.yml @@ -65,6 +65,7 @@ jobs: - requirements-dev.txt - mypy.ini - pytest.ini + - frontend/src/queries/schema.json # Used for generating schema.py # Make sure we run if someone is explicitly change the workflow - .github/workflows/ci-backend.yml - .github/workflows/backend-tests-action/action.yml diff --git a/posthog/schema.py b/posthog/schema.py index d97db09c71f21..28bad7dd7ad5e 100644 --- a/posthog/schema.py +++ b/posthog/schema.py @@ -358,6 +358,13 @@ class RetentionReference1(str, Enum): previous = "previous" +class RetentionPeriod(str, Enum): + Hour = "Hour" + Day = "Day" + Week = "Week" + Month = "Month" + + class RetentionType(str, Enum): retention_recurring = "retention_recurring" retention_first_time = "retention_first_time" @@ -554,7 +561,7 @@ class RetentionFilter(BaseModel): class Config: extra = Extra.forbid - period: Optional[str] = None + period: Optional[RetentionPeriod] = None retention_reference: Optional[RetentionReference1] = None retention_type: Optional[RetentionType] = None returning_entity: Optional[Dict[str, Any]] = None @@ -941,41 +948,6 @@ class Config: trendsFilter: Optional[TrendsFilter] = Field(None, description="Properties specific to the trends insight") -class UnimplementedQuery(BaseModel): - class Config: - extra = Extra.forbid - - aggregation_group_type_index: Optional[float] = Field(None, description="Groups aggregation") - dateRange: Optional[DateRange] = Field(None, description="Date range for the query") - filterTestAccounts: Optional[bool] = Field( - None, description="Exclude internal and test users by applying the respective filters" - ) - kind: str = Field( - "UnimplementedQuery", - const=True, - description="Used for insights that haven't been converted to the new query format yet", - ) - properties: Optional[ - Union[ - List[ - Union[ - EventPropertyFilter, - PersonPropertyFilter, - ElementPropertyFilter, - SessionPropertyFilter, - CohortPropertyFilter, - RecordingDurationFilter, - GroupPropertyFilter, - FeaturePropertyFilter, - HogQLPropertyFilter, - EmptyPropertyFilter, - ] - ], - PropertyGroupFilter, - ] - ] = Field(None, description="Property filters for all series") - - class AnyPartialFilterTypeItem(BaseModel): class Config: extra = Extra.forbid @@ -1230,7 +1202,7 @@ class Config: insight: Optional[InsightType] = None interval: Optional[IntervalType] = None new_entity: Optional[List[Dict[str, Any]]] = None - period: Optional[str] = None + period: Optional[RetentionPeriod] = None properties: Optional[ Union[ List[ @@ -1472,9 +1444,7 @@ class Config: extra = Extra.forbid kind: str = Field("InsightVizNode", const=True) - source: Union[ - TrendsQuery, FunnelsQuery, RetentionQuery, PathsQuery, StickinessQuery, LifecycleQuery, UnimplementedQuery - ] + source: Union[TrendsQuery, FunnelsQuery, RetentionQuery, PathsQuery, StickinessQuery, LifecycleQuery] class Model(BaseModel):