Skip to content

Commit

Permalink
fix(data-exploration): Ensure query schema sync (#14081)
Browse files Browse the repository at this point in the history
  • Loading branch information
Twixes authored Feb 3, 2023
1 parent 7a25d1d commit 2b90826
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 40 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
50 changes: 10 additions & 40 deletions posthog/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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[
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 2b90826

Please sign in to comment.