Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(data-exploration): Ensure query schema sync #14081

Merged
merged 1 commit into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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