diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json index 40df13d525209..7706b8e59b10d 100644 --- a/frontend/src/queries/schema.json +++ b/frontend/src/queries/schema.json @@ -15,7 +15,7 @@ "type": "array" }, "id": { - "type": "number" + "type": "integer" }, "kind": { "const": "ActionsNode", @@ -334,16 +334,16 @@ "$ref": "#/definitions/BreakdownKeyType" }, "breakdown_group_type_index": { - "type": ["number", "null"] + "type": "integer" }, "breakdown_hide_other_aggregation": { "type": ["boolean", "null"] }, "breakdown_histogram_bin_count": { - "type": "number" + "type": "integer" }, "breakdown_limit": { - "type": "number" + "type": "integer" }, "breakdown_normalize_url": { "type": "boolean" @@ -965,7 +965,7 @@ "type": "string" }, "limit": { - "type": "number" + "type": "integer" }, "math": { "anyOf": [ @@ -2314,7 +2314,7 @@ "additionalProperties": false, "properties": { "cohort": { - "type": "number" + "type": "integer" }, "distinctId": { "type": "string" @@ -2331,10 +2331,10 @@ "type": "string" }, "limit": { - "type": "number" + "type": "integer" }, "offset": { - "type": "number" + "type": "integer" }, "properties": { "description": "Properties configurable in the interface", @@ -3661,7 +3661,7 @@ }, "teamId": { "description": "Project to filter on. Defaults to current project", - "type": "number" + "type": "integer" } }, "required": ["kind"], @@ -3684,7 +3684,7 @@ }, "teamId": { "description": "Project to filter on. Defaults to current project", - "type": "number" + "type": "integer" } }, "required": ["kind"], diff --git a/frontend/src/queries/schema.ts b/frontend/src/queries/schema.ts index d705cc839240e..79b4bf385aaa2 100644 --- a/frontend/src/queries/schema.ts +++ b/frontend/src/queries/schema.ts @@ -255,6 +255,7 @@ export interface EventsNode extends EntityNode { kind: NodeKind.EventsNode /** The event or `null` for all events. */ event?: string | null + /** @asType integer */ limit?: number /** Columns to order by */ orderBy?: string[] @@ -267,6 +268,7 @@ export interface EventsNode extends EntityNode { export interface ActionsNode extends EntityNode { kind: NodeKind.ActionsNode + /** @asType integer */ id: number } @@ -339,13 +341,16 @@ export interface EventsQuery extends DataNode { export interface PersonsNode extends DataNode { kind: NodeKind.PersonsNode search?: string + /** @asType integer */ cohort?: number distinctId?: string /** Properties configurable in the interface */ properties?: AnyPropertyFilter[] /** Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person) */ fixedProperties?: AnyPropertyFilter[] + /** @asType integer */ limit?: number + /** @asType integer */ offset?: number } @@ -891,7 +896,10 @@ export interface TimeToSeeDataSessionsQuery extends DataNode { /** Date range for the query */ dateRange?: DateRange - /** Project to filter on. Defaults to current project */ + /** + * Project to filter on. Defaults to current project + * @asType integer + */ teamId?: number response?: TimeToSeeDataSessionsQueryResponse @@ -914,7 +922,10 @@ export interface DatabaseSchemaQuery extends DataNode { export interface TimeToSeeDataQuery extends DataNode { kind: NodeKind.TimeToSeeDataQuery - /** Project to filter on. Defaults to current project */ + /** + * Project to filter on. Defaults to current project + * @asType integer + */ teamId?: number /** Project to filter on. Defaults to current session */ @@ -949,11 +960,14 @@ export interface DateRange { export interface BreakdownFilter { // TODO: unclutter breakdown_type?: BreakdownType | null + /** @asType integer */ breakdown_limit?: number breakdown?: BreakdownKeyType breakdown_normalize_url?: boolean breakdowns?: Breakdown[] + /** @asType integer */ breakdown_group_type_index?: number | null + /** @asType integer */ breakdown_histogram_bin_count?: number // trends breakdown histogram bin count breakdown_hide_other_aggregation?: boolean | null // hides the "other" field for trends } diff --git a/mypy-baseline.txt b/mypy-baseline.txt index 061cc288ffcd5..4e597da7721b0 100644 --- a/mypy-baseline.txt +++ b/mypy-baseline.txt @@ -365,7 +365,6 @@ posthog/hogql/query.py:0: error: Argument 1 to "get_default_limit_for_context" h posthog/hogql/query.py:0: error: "SelectQuery" has no attribute "select_queries" [attr-defined] posthog/hogql/query.py:0: error: Subclass of "SelectQuery" and "SelectUnionQuery" cannot exist: would have incompatible method signatures [unreachable] posthog/hogql_queries/query_runner.py:0: error: Incompatible types in assignment (expression has type "HogQLQuery | TrendsQuery | LifecycleQuery | InsightActorsQuery | EventsQuery | ActorsQuery | RetentionQuery | SessionsTimelineQuery | WebOverviewQuery | WebTopClicksQuery | WebStatsTableQuery | StickinessQuery | BaseModel | dict[str, Any]", variable has type "HogQLQuery | TrendsQuery | LifecycleQuery | InsightActorsQuery | EventsQuery | ActorsQuery | RetentionQuery | SessionsTimelineQuery | WebOverviewQuery | WebTopClicksQuery | WebStatsTableQuery | StickinessQuery") [assignment] -posthog/hogql_queries/insights/trends/breakdown_values.py:0: error: Incompatible types in assignment (expression has type "float | int", variable has type "int") [assignment] posthog/hogql_queries/insights/trends/breakdown_values.py:0: error: Item "SelectUnionQuery" of "SelectQuery | SelectUnionQuery" has no attribute "select" [union-attr] posthog/hogql_queries/insights/trends/breakdown_values.py:0: error: Value of type "list[Any] | None" is not indexable [index] posthog/hogql_queries/sessions_timeline_query_runner.py:0: error: Statement is unreachable [unreachable] @@ -433,7 +432,6 @@ posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: Item "Non posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: Item "None" of "BreakdownFilter | None" has no attribute "breakdown" [union-attr] posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: Argument 1 to "_event_property" of "TrendsQueryRunner" has incompatible type "str | float | list[str | float] | Any | None"; expected "str" [arg-type] posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: Item "None" of "BreakdownFilter | None" has no attribute "breakdown_group_type_index" [union-attr] -posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: Argument 3 to "_event_property" of "TrendsQueryRunner" has incompatible type "float | Any | None"; expected "int | None" [arg-type] posthog/hogql_queries/insights/retention_query_runner.py:0: error: Incompatible types in assignment (expression has type "Expr", variable has type "Call") [assignment] posthog/hogql_queries/insights/retention_query_runner.py:0: error: Incompatible types in assignment (expression has type "Call", variable has type "Field") [assignment] posthog/hogql_queries/insights/retention_query_runner.py:0: error: Argument "select" to "SelectQuery" has incompatible type "list[Alias]"; expected "list[Expr]" [arg-type] diff --git a/posthog/hogql_queries/insights/trends/breakdown_values.py b/posthog/hogql_queries/insights/trends/breakdown_values.py index b1cd87868590a..dcbc431f624c0 100644 --- a/posthog/hogql_queries/insights/trends/breakdown_values.py +++ b/posthog/hogql_queries/insights/trends/breakdown_values.py @@ -25,7 +25,7 @@ class BreakdownValues: histogram_bin_count: Optional[int] group_type_index: Optional[int] hide_other_aggregation: Optional[bool] - breakdown_limit: Optional[float] + breakdown_limit: Optional[int] def __init__( self, @@ -36,10 +36,10 @@ def __init__( breakdown_type: str, events_filter: ast.Expr, chart_display_type: ChartDisplayType, - histogram_bin_count: Optional[float] = None, - group_type_index: Optional[float] = None, + histogram_bin_count: Optional[int] = None, + group_type_index: Optional[int] = None, hide_other_aggregation: Optional[bool] = False, - breakdown_limit: Optional[float] = None, + breakdown_limit: Optional[int] = None, ): self.team = team self.event_name = event_name diff --git a/posthog/schema.py b/posthog/schema.py index c8df43c2e0345..57287116ecaa3 100644 --- a/posthog/schema.py +++ b/posthog/schema.py @@ -612,7 +612,7 @@ class TimeToSeeDataQuery(BaseModel): sessionStart: Optional[str] = Field( default=None, description="Session start time. Defaults to current time - 2 hours" ) - teamId: Optional[float] = Field(default=None, description="Project to filter on. Defaults to current project") + teamId: Optional[int] = Field(default=None, description="Project to filter on. Defaults to current project") class TimeToSeeDataSessionsQueryResponse(BaseModel): @@ -829,10 +829,10 @@ class BreakdownFilter(BaseModel): extra="forbid", ) breakdown: Optional[Union[str, float, List[Union[str, float]]]] = None - breakdown_group_type_index: Optional[float] = None + breakdown_group_type_index: Optional[int] = None breakdown_hide_other_aggregation: Optional[bool] = None - breakdown_histogram_bin_count: Optional[float] = None - breakdown_limit: Optional[float] = None + breakdown_histogram_bin_count: Optional[int] = None + breakdown_limit: Optional[int] = None breakdown_normalize_url: Optional[bool] = None breakdown_type: Optional[BreakdownType] = None breakdowns: Optional[List[Breakdown]] = None @@ -1230,7 +1230,7 @@ class TimeToSeeDataSessionsQuery(BaseModel): dateRange: Optional[DateRange] = Field(default=None, description="Date range for the query") kind: Literal["TimeToSeeDataSessionsQuery"] = "TimeToSeeDataSessionsQuery" response: Optional[TimeToSeeDataSessionsQueryResponse] = Field(default=None, description="Cached query response") - teamId: Optional[float] = Field(default=None, description="Project to filter on. Defaults to current project") + teamId: Optional[int] = Field(default=None, description="Project to filter on. Defaults to current project") class WebAnalyticsQueryBase(BaseModel): @@ -1396,7 +1396,7 @@ class EventsNode(BaseModel): description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", ) kind: Literal["EventsNode"] = "EventsNode" - limit: Optional[float] = None + limit: Optional[int] = None math: Optional[ Union[BaseMathType, PropertyMathType, CountPerActorMathType, Literal["unique_group"], Literal["hogql"]] ] = None @@ -1525,7 +1525,7 @@ class PersonsNode(BaseModel): model_config = ConfigDict( extra="forbid", ) - cohort: Optional[float] = None + cohort: Optional[int] = None distinctId: Optional[str] = None fixedProperties: Optional[ List[ @@ -1547,8 +1547,8 @@ class PersonsNode(BaseModel): description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", ) kind: Literal["PersonsNode"] = "PersonsNode" - limit: Optional[float] = None - offset: Optional[float] = None + limit: Optional[int] = None + offset: Optional[int] = None properties: Optional[ List[ Union[ @@ -1692,7 +1692,7 @@ class ActionsNode(BaseModel): default=None, description="Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)", ) - id: float + id: int kind: Literal["ActionsNode"] = "ActionsNode" math: Optional[ Union[BaseMathType, PropertyMathType, CountPerActorMathType, Literal["unique_group"], Literal["hogql"]]