Skip to content

Commit

Permalink
Improve typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Twixes committed Mar 19, 2024
1 parent 75b59e1 commit 92bfec6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion posthog/api/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def create(self, request, *args, **kwargs) -> Response:
user_id=self.request.user.pk,
query_json=request.data["query"],
query_id=client_query_id,
refresh_requested=data.refresh,
refresh_requested=data.refresh or False,
)
return Response(query_status.model_dump(), status=status.HTTP_202_ACCEPTED)

Expand Down
9 changes: 7 additions & 2 deletions posthog/clickhouse/client/execute_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ def delete_query_status(self):


def execute_process_query(
team_id: int, user_id: int, query_id: str, query_json: str, limit_context: LimitContext, refresh_requested: bool
team_id: int,
user_id: int,
query_id: str,
query_json: dict,
limit_context: Optional[LimitContext],
refresh_requested: bool,
):
manager = QueryStatusManager(query_id, team_id)

Expand Down Expand Up @@ -112,7 +117,7 @@ def execute_process_query(
def enqueue_process_query_task(
team_id: int,
user_id: int,
query_json: str,
query_json: dict,
query_id: Optional[str] = None,
refresh_requested: bool = False,
force: bool = False,
Expand Down
9 changes: 5 additions & 4 deletions posthog/tasks/tasks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import time
from typing import Any, Optional
from typing import Optional
from uuid import UUID

from celery import shared_task
Expand All @@ -9,6 +9,7 @@
from prometheus_client import Gauge

from posthog.cloud_utils import is_cloud
from posthog.hogql.constants import LimitContext
from posthog.metrics import pushed_metrics_registry
from posthog.ph_client import get_ph_client
from posthog.redis import get_client
Expand All @@ -33,11 +34,11 @@ def redis_heartbeat() -> None:

@shared_task(ignore_result=True, queue=CeleryQueue.ANALYTICS_QUERIES.value)
def process_query_task(
team_id: str,
team_id: int,
user_id: str,
query_id: str,
query_json: Any,
limit_context: Any = None,
query_json: dict,
limit_context: Optional[LimitContext] = None,
refresh_requested: bool = False,
) -> None:
"""
Expand Down

0 comments on commit 92bfec6

Please sign in to comment.