diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json index c6f96b0a3980d..313b48d202b74 100644 --- a/frontend/src/queries/schema.json +++ b/frontend/src/queries/schema.json @@ -2446,509 +2446,504 @@ ], "type": "string" }, - "QueryCombinedResponse": { + "QueryRequest": { "additionalProperties": false, "properties": { - "clickhouse": { - "anyOf": [ - {}, - { - "description": "Executed ClickHouse query", + "async": { + "description": "(Experimental) Whether to run the query asynchronously. Defaults to False. If True, the `id` of the query can be used to check the status and to cancel it.", + "examples": [true], + "type": "boolean" + }, + "client_query_id": { + "description": "Client provided query ID. Can be used to retrieve the status or cancel the query.", + "type": "string" + }, + "query": { + "$ref": "#/definitions/QuerySchema", + "description": "Submit a JSON string representing a query for PostHog data analysis, for example a HogQL query.\n\nExample payload:\n\n```\n\n{\"query\": {\"kind\": \"HogQLQuery\", \"query\": \"select * from events limit 100\"}}\n\n```\n\nFor more details on HogQL queries, see the [PostHog HogQL documentation](/docs/hogql#api-access)." + }, + "refresh": { + "type": "boolean" + } + }, + "required": ["query"], + "type": "object" + }, + "QueryResponse": { + "additionalProperties": false, + "properties": { + "hogql": { + "type": "string" + }, + "is_cached": { + "type": "boolean" + }, + "last_refresh": { + "type": "string" + }, + "next_allowed_client_refresh": { + "type": "string" + }, + "results": { + "items": {}, + "type": "array" + }, + "timings": { + "items": { + "$ref": "#/definitions/QueryTiming" + }, + "type": "array" + } + }, + "required": ["results"], + "type": "object" + }, + "QueryResponseAlternative": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "next": { "type": "string" }, - { + "results": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "$ref": "#/definitions/EventType" }, "type": "array" } - ] + }, + "required": ["results"], + "type": "object" }, - "columns": { - "anyOf": [ - {}, - { - "items": {}, - "type": "array" - }, - { - "description": "Returned columns", - "items": {}, - "type": "array" - }, - { - "items": {}, - "type": "array" - }, - { + { + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "results": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "type": "object" }, "type": "array" } - ] + }, + "required": ["results"], + "type": "object" }, - "error": { - "anyOf": [ - {}, - { - "description": "Query error. Returned only if 'explain' is true. Throws an error otherwise.", + { + "additionalProperties": false, + "properties": { + "columns": { + "items": {}, + "type": "array" + }, + "hasMore": { + "type": "boolean" + }, + "hogql": { "type": "string" }, - { + "limit": { + "type": "integer" + }, + "offset": { + "type": "integer" + }, + "results": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "items": {}, + "type": "array" }, "type": "array" - } - ] - }, - "errors": { - "anyOf": [ - {}, - { + }, + "timings": { "items": { - "$ref": "#/definitions/HogQLNotice" + "$ref": "#/definitions/QueryTiming" }, "type": "array" }, - { + "types": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "type": "string" }, "type": "array" } - ] + }, + "required": ["columns", "types", "results", "hogql"], + "type": "object" }, - "explain": { - "anyOf": [ - {}, - { - "description": "Query explanation output", - "items": { - "type": "string" - }, + { + "additionalProperties": false, + "properties": { + "columns": { + "items": {}, "type": "array" }, - { - "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" - }, - "type": "array" - } - ] - }, - "hasMore": { - "anyOf": [ - {}, - { + "hasMore": { "type": "boolean" }, - { - "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" - }, - "type": "array" - } - ] - }, - "hogql": { - "anyOf": [ - {}, - { + "hogql": { "type": "string" }, - { - "description": "Generated HogQL query", - "type": "string" + "limit": { + "type": "integer" }, - { - "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" - }, - "type": "array" - } - ] - }, - "inputExpr": { - "anyOf": [ - {}, - { - "type": "string" + "missing_actors_count": { + "type": "integer" }, - { + "offset": { + "type": "integer" + }, + "results": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "items": {}, + "type": "array" }, "type": "array" - } - ] - }, - "inputSelect": { - "anyOf": [ - {}, - { - "type": "string" }, - { + "timings": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "$ref": "#/definitions/QueryTiming" }, "type": "array" - } - ] - }, - "isValid": { - "anyOf": [ - {}, - { - "type": "boolean" }, - { + "types": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "type": "string" }, "type": "array" } - ] + }, + "required": ["results", "columns", "types", "hogql", "limit", "offset"], + "type": "object" }, - "isValidView": { - "anyOf": [ - {}, - { + { + "additionalProperties": false, + "properties": { + "hasMore": { "type": "boolean" }, - { + "hogql": { + "type": "string" + }, + "results": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "$ref": "#/definitions/TimelineEntry" }, "type": "array" - } - ] - }, - "is_cached": { - "anyOf": [ - {}, - { - "type": "boolean" }, - { + "timings": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "$ref": "#/definitions/QueryTiming" }, "type": "array" } - ] + }, + "required": ["results"], + "type": "object" }, - "last_refresh": { - "anyOf": [ - {}, - { + { + "additionalProperties": false, + "properties": { + "clickhouse": { + "description": "Executed ClickHouse query", "type": "string" }, - { - "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" - }, + "columns": { + "description": "Returned columns", + "items": {}, "type": "array" - } - ] - }, - "limit": { - "anyOf": [ - {}, - { - "type": "integer" }, - { - "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" - }, - "type": "array" - } - ] - }, - "missing_actors_count": { - "anyOf": [ - {}, - { - "type": "integer" + "error": { + "description": "Query error. Returned only if 'explain' is true. Throws an error otherwise.", + "type": "string" }, - { + "explain": { + "description": "Query explanation output", "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "type": "string" }, "type": "array" - } - ] - }, - "modifiers": { - "anyOf": [ - {}, - { + }, + "hogql": { + "description": "Generated HogQL query", + "type": "string" + }, + "modifiers": { "$ref": "#/definitions/HogQLQueryModifiers", "description": "Modifiers used when performing the query" }, - { + "query": { + "description": "Input query string", + "type": "string" + }, + "results": { + "description": "Query results", + "items": {}, + "type": "array" + }, + "timings": { + "description": "Measured timings for different parts of the query generation process", "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "$ref": "#/definitions/QueryTiming" }, "type": "array" + }, + "types": { + "description": "Types of returned columns", + "items": {}, + "type": "array" } - ] + }, + "type": "object" }, - "next": { - "anyOf": [ - { - "type": "string" - }, - {}, - { + { + "additionalProperties": false, + "properties": { + "errors": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "$ref": "#/definitions/HogQLNotice" }, "type": "array" - } - ] - }, - "next_allowed_client_refresh": { - "anyOf": [ - {}, - { + }, + "inputExpr": { + "type": "string" + }, + "inputSelect": { "type": "string" }, - { - "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" - }, - "type": "array" - } - ] - }, - "notices": { - "anyOf": [ - {}, - { + "isValid": { + "type": "boolean" + }, + "isValidView": { + "type": "boolean" + }, + "notices": { "items": { "$ref": "#/definitions/HogQLNotice" }, "type": "array" }, - { + "warnings": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "$ref": "#/definitions/HogQLNotice" }, "type": "array" } - ] + }, + "required": ["errors", "warnings", "notices"], + "type": "object" }, - "offset": { - "anyOf": [ - {}, - { - "type": "integer" + { + "additionalProperties": false, + "properties": { + "hogql": { + "type": "string" }, - { + "is_cached": { + "type": "boolean" + }, + "last_refresh": { + "type": "string" + }, + "next_allowed_client_refresh": { + "type": "string" + }, + "results": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "$ref": "#/definitions/WebOverviewItem" }, "type": "array" - } - ] - }, - "query": { - "anyOf": [ - {}, - { - "description": "Input query string", - "type": "string" }, - { + "timings": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "$ref": "#/definitions/QueryTiming" }, "type": "array" } - ] + }, + "required": ["results"], + "type": "object" }, - "results": { - "anyOf": [ - { - "items": { - "$ref": "#/definitions/EventType" - }, + { + "additionalProperties": false, + "properties": { + "columns": { + "items": {}, "type": "array" }, - {}, - { - "items": { - "type": "object" - }, - "type": "array" + "hogql": { + "type": "string" }, - { - "items": { - "items": {}, - "type": "array" - }, + "is_cached": { + "type": "boolean" + }, + "last_refresh": { + "type": "string" + }, + "next_allowed_client_refresh": { + "type": "string" + }, + "results": { + "items": {}, "type": "array" }, - { + "timings": { "items": { - "$ref": "#/definitions/TimelineEntry" + "$ref": "#/definitions/QueryTiming" }, "type": "array" }, - { - "description": "Query results", + "types": { "items": {}, "type": "array" - }, - { - "items": { - "$ref": "#/definitions/WebOverviewItem" - }, + } + }, + "required": ["results"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "columns": { + "items": {}, "type": "array" }, - { + "hogql": { + "type": "string" + }, + "is_cached": { + "type": "boolean" + }, + "last_refresh": { + "type": "string" + }, + "next_allowed_client_refresh": { + "type": "string" + }, + "results": { "items": {}, "type": "array" }, - { + "timings": { "items": { - "$ref": "#/definitions/RetentionResult" + "$ref": "#/definitions/QueryTiming" }, "type": "array" }, - { - "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" - }, + "types": { + "items": {}, "type": "array" } - ] + }, + "required": ["results"], + "type": "object" }, - "timings": { - "anyOf": [ - {}, - { - "items": { - "$ref": "#/definitions/QueryTiming" - }, - "type": "array" + { + "additionalProperties": false, + "properties": { + "hogql": { + "type": "string" }, - { - "description": "Measured timings for different parts of the query generation process", + "is_cached": { + "type": "boolean" + }, + "last_refresh": { + "type": "string" + }, + "next_allowed_client_refresh": { + "type": "string" + }, + "results": { "items": { - "$ref": "#/definitions/QueryTiming" + "type": "object" }, "type": "array" }, - { + "timings": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "$ref": "#/definitions/QueryTiming" }, "type": "array" } - ] + }, + "required": ["results"], + "type": "object" }, - "types": { - "anyOf": [ - {}, - { - "items": { - "type": "string" - }, - "type": "array" + { + "additionalProperties": false, + "properties": { + "hogql": { + "type": "string" }, - { - "description": "Types of returned columns", - "items": {}, - "type": "array" + "is_cached": { + "type": "boolean" }, - { - "items": {}, + "last_refresh": { + "type": "string" + }, + "next_allowed_client_refresh": { + "type": "string" + }, + "results": { + "items": { + "$ref": "#/definitions/RetentionResult" + }, "type": "array" }, - { + "timings": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "$ref": "#/definitions/QueryTiming" }, "type": "array" } - ] + }, + "required": ["results"], + "type": "object" }, - "warnings": { - "anyOf": [ - {}, - { + { + "additionalProperties": false, + "properties": { + "hogql": { + "type": "string" + }, + "is_cached": { + "type": "boolean" + }, + "last_refresh": { + "type": "string" + }, + "next_allowed_client_refresh": { + "type": "string" + }, + "results": { "items": { - "$ref": "#/definitions/HogQLNotice" + "type": "object" }, "type": "array" }, - { + "timings": { "items": { - "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + "$ref": "#/definitions/QueryTiming" }, "type": "array" } - ] - } - }, - "type": "object" - }, - "QueryRequest": { - "additionalProperties": false, - "properties": { - "async": { - "description": "(Experimental) Whether to run the query asynchronously. Defaults to False. If True, the `id` of the query can be used to check the status and to cancel it.", - "examples": [true], - "type": "boolean" - }, - "client_query_id": { - "description": "Client provided query ID. Can be used to retrieve the status or cancel the query.", - "type": "string" - }, - "query": { - "$ref": "#/definitions/QuerySchema", - "description": "Submit a JSON string representing a query for PostHog data analysis, for example a HogQL query.\n\nExample payload:\n\n```\n\n{\"query\": {\"kind\": \"HogQLQuery\", \"query\": \"select * from events limit 100\"}}\n\n```\n\nFor more details on HogQL queries, see the [PostHog HogQL documentation](/docs/hogql#api-access)." - }, - "refresh": { - "type": "boolean" - } - }, - "required": ["query"], - "type": "object" - }, - "QueryResponse": { - "additionalProperties": false, - "properties": { - "hogql": { - "type": "string" - }, - "is_cached": { - "type": "boolean" - }, - "last_refresh": { - "type": "string" - }, - "next_allowed_client_refresh": { - "type": "string" - }, - "results": { - "items": {}, - "type": "array" + }, + "required": ["results"], + "type": "object" }, - "timings": { - "items": { - "$ref": "#/definitions/QueryTiming" + { + "additionalProperties": { + "items": { + "$ref": "#/definitions/DatabaseSchemaQueryResponseField" + }, + "type": "array" }, - "type": "array" + "type": "object" } - }, - "required": ["results"], - "type": "object" + ] }, "QuerySchema": { "discriminator": { diff --git a/frontend/src/queries/schema.ts b/frontend/src/queries/schema.ts index b9d4b3f36749f..5017bc205ac4a 100644 --- a/frontend/src/queries/schema.ts +++ b/frontend/src/queries/schema.ts @@ -133,13 +133,10 @@ export type QuerySchema = // Keep this, because QuerySchema itself will be collapsed as it is used in other models export type QuerySchemaRoot = QuerySchema -// Dynamically make a union type out of all the "response" fields in QuerySchema -type ResponseType = T extends { response: infer R } ? R : never -type AllResponses = ResponseType -type Unionize = Partial<{ - [P in keyof T]: T[P] -}> -export type QueryCombinedResponse = Unionize +// Dynamically make a union type out of all the types in all `response` fields in QuerySchema +type QueryResponseType = T extends { response: infer R } ? { response: R } : never +type QueryAllResponses = QueryResponseType +export type QueryResponseAlternative = QueryAllResponses[keyof QueryAllResponses] /** Node base class, everything else inherits from here */ export interface Node { diff --git a/posthog/api/query.py b/posthog/api/query.py index 8423bcfb11995..c4dab36066adc 100644 --- a/posthog/api/query.py +++ b/posthog/api/query.py @@ -35,7 +35,7 @@ AISustainedRateThrottle, TeamRateThrottle, ) -from posthog.schema import QueryRequest, QueryCombinedResponse +from posthog.schema import QueryRequest, QueryResponseAlternative class QueryThrottle(TeamRateThrottle): @@ -59,7 +59,7 @@ def get_throttles(self): @extend_schema( request=QueryRequest, responses={ - 200: QueryCombinedResponse, + 200: QueryResponseAlternative, }, ) def create(self, request, *args, **kwargs) -> Response: diff --git a/posthog/schema.py b/posthog/schema.py index 84c2a439111a5..e800f33786b78 100644 --- a/posthog/schema.py +++ b/posthog/schema.py @@ -454,6 +454,34 @@ class PropertyOperator(str, Enum): max = "max" +class QueryResponseAlternative1(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + next: Optional[str] = None + results: List[EventType] + + +class QueryResponseAlternative2(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + results: List[Dict[str, Any]] + + +class QueryResponseAlternative7(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + errors: List[HogQLNotice] + inputExpr: Optional[str] = None + inputSelect: Optional[str] = None + isValid: Optional[bool] = None + isValidView: Optional[bool] = None + notices: List[HogQLNotice] + warnings: List[HogQLNotice] + + class QueryStatus(BaseModel): model_config = ConfigDict( extra="forbid", @@ -980,6 +1008,105 @@ class QueryResponse(BaseModel): timings: Optional[List[QueryTiming]] = None +class QueryResponseAlternative3(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + columns: List + hasMore: Optional[bool] = None + hogql: str + limit: Optional[int] = None + offset: Optional[int] = None + results: List[List] + timings: Optional[List[QueryTiming]] = None + types: List[str] + + +class QueryResponseAlternative4(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + columns: List + hasMore: Optional[bool] = None + hogql: str + limit: int + missing_actors_count: Optional[int] = None + offset: int + results: List[List] + timings: Optional[List[QueryTiming]] = None + types: List[str] + + +class QueryResponseAlternative5(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + hasMore: Optional[bool] = None + hogql: Optional[str] = None + results: List[TimelineEntry] + timings: Optional[List[QueryTiming]] = None + + +class QueryResponseAlternative6(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + clickhouse: Optional[str] = Field(default=None, description="Executed ClickHouse query") + columns: Optional[List] = Field(default=None, description="Returned columns") + error: Optional[str] = Field( + default=None, description="Query error. Returned only if 'explain' is true. Throws an error otherwise." + ) + explain: Optional[List[str]] = Field(default=None, description="Query explanation output") + hogql: Optional[str] = Field(default=None, description="Generated HogQL query") + modifiers: Optional[HogQLQueryModifiers] = Field( + default=None, description="Modifiers used when performing the query" + ) + query: Optional[str] = Field(default=None, description="Input query string") + results: Optional[List] = Field(default=None, description="Query results") + timings: Optional[List[QueryTiming]] = Field( + default=None, description="Measured timings for different parts of the query generation process" + ) + types: Optional[List] = Field(default=None, description="Types of returned columns") + + +class QueryResponseAlternative8(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + hogql: Optional[str] = None + is_cached: Optional[bool] = None + last_refresh: Optional[str] = None + next_allowed_client_refresh: Optional[str] = None + results: List[WebOverviewItem] + timings: Optional[List[QueryTiming]] = None + + +class QueryResponseAlternative9(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + columns: Optional[List] = None + hogql: Optional[str] = None + is_cached: Optional[bool] = None + last_refresh: Optional[str] = None + next_allowed_client_refresh: Optional[str] = None + results: List + timings: Optional[List[QueryTiming]] = None + types: Optional[List] = None + + +class QueryResponseAlternative11(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + hogql: Optional[str] = None + is_cached: Optional[bool] = None + last_refresh: Optional[str] = None + next_allowed_client_refresh: Optional[str] = None + results: List[Dict[str, Any]] + timings: Optional[List[QueryTiming]] = None + + class RetentionFilter(BaseModel): model_config = ConfigDict( extra="forbid", @@ -1445,47 +1572,52 @@ class PropertyGroupFilterValue(BaseModel): ] -class QueryCombinedResponse(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - clickhouse: Optional[Union[Any, str, List[DatabaseSchemaQueryResponseField]]] = None - columns: Optional[Union[Any, List, List[DatabaseSchemaQueryResponseField]]] = None - error: Optional[Union[Any, str, List[DatabaseSchemaQueryResponseField]]] = None - errors: Optional[Union[Any, List[HogQLNotice], List[DatabaseSchemaQueryResponseField]]] = None - explain: Optional[Union[Any, List[str], List[DatabaseSchemaQueryResponseField]]] = None - hasMore: Optional[Union[Any, bool, List[DatabaseSchemaQueryResponseField]]] = None - hogql: Optional[Union[Any, str, List[DatabaseSchemaQueryResponseField]]] = None - inputExpr: Optional[Union[Any, str, List[DatabaseSchemaQueryResponseField]]] = None - inputSelect: Optional[Union[Any, str, List[DatabaseSchemaQueryResponseField]]] = None - isValid: Optional[Union[Any, bool, List[DatabaseSchemaQueryResponseField]]] = None - isValidView: Optional[Union[Any, bool, List[DatabaseSchemaQueryResponseField]]] = None - is_cached: Optional[Union[Any, bool, List[DatabaseSchemaQueryResponseField]]] = None - last_refresh: Optional[Union[Any, str, List[DatabaseSchemaQueryResponseField]]] = None - limit: Optional[Union[Any, int, List[DatabaseSchemaQueryResponseField]]] = None - missing_actors_count: Optional[Union[Any, int, List[DatabaseSchemaQueryResponseField]]] = None - modifiers: Optional[Union[Any, HogQLQueryModifiers, List[DatabaseSchemaQueryResponseField]]] = None - next: Optional[Union[str, Any, List[DatabaseSchemaQueryResponseField]]] = None - next_allowed_client_refresh: Optional[Union[Any, str, List[DatabaseSchemaQueryResponseField]]] = None - notices: Optional[Union[Any, List[HogQLNotice], List[DatabaseSchemaQueryResponseField]]] = None - offset: Optional[Union[Any, int, List[DatabaseSchemaQueryResponseField]]] = None - query: Optional[Union[Any, str, List[DatabaseSchemaQueryResponseField]]] = None - results: Optional[ +class QueryResponseAlternative12(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + hogql: Optional[str] = None + is_cached: Optional[bool] = None + last_refresh: Optional[str] = None + next_allowed_client_refresh: Optional[str] = None + results: List[RetentionResult] + timings: Optional[List[QueryTiming]] = None + + +class QueryResponseAlternative( + RootModel[ Union[ - List[EventType], - Any, - List[Dict[str, Any]], - List[List], - List[TimelineEntry], - List, - List[WebOverviewItem], - List[RetentionResult], - List[DatabaseSchemaQueryResponseField], + QueryResponseAlternative1, + Dict[str, Any], + QueryResponseAlternative2, + QueryResponseAlternative3, + QueryResponseAlternative4, + QueryResponseAlternative5, + QueryResponseAlternative6, + QueryResponseAlternative7, + QueryResponseAlternative8, + QueryResponseAlternative9, + QueryResponseAlternative11, + QueryResponseAlternative12, + Dict[str, List[DatabaseSchemaQueryResponseField]], ] - ] = None - timings: Optional[Union[Any, List[QueryTiming], List[DatabaseSchemaQueryResponseField]]] = None - types: Optional[Union[Any, List[str], List, List[DatabaseSchemaQueryResponseField]]] = None - warnings: Optional[Union[Any, List[HogQLNotice], List[DatabaseSchemaQueryResponseField]]] = None + ] +): + root: Union[ + QueryResponseAlternative1, + Dict[str, Any], + QueryResponseAlternative2, + QueryResponseAlternative3, + QueryResponseAlternative4, + QueryResponseAlternative5, + QueryResponseAlternative6, + QueryResponseAlternative7, + QueryResponseAlternative8, + QueryResponseAlternative9, + QueryResponseAlternative11, + QueryResponseAlternative12, + Dict[str, List[DatabaseSchemaQueryResponseField]], + ] class RetentionQueryResponse(BaseModel):