0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/ee/api/debug_ch_queries.py
2021-08-23 12:17:12 +02:00

16 lines
401 B
Python

import json
from rest_framework import mixins, viewsets
from rest_framework.response import Response
from posthog.utils import get_safe_cache
class DebugCHQueries(mixins.ListModelMixin, viewsets.GenericViewSet):
"""
Show recent queries for this user
"""
def list(self, request):
return Response(json.loads(get_safe_cache("save_query_{}".format(request.user.pk)) or "[]"))