0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00
posthog/ee/api/debug_ch_queries.py
Yakko Majuri 8087f5f1dd
Handle corrupted cache (#3169)
* Handle corrupted cache

* fix errors

* code quality

* minor update
2021-02-03 09:22:42 +00:00

20 lines
470 B
Python

import json
from rest_framework import viewsets
from rest_framework.response import Response
from posthog.models.team import Team
from posthog.utils import get_safe_cache
class DebugCHQueries(viewsets.ViewSet):
"""
Show recent queries for this user
"""
def list(self, request):
return Response(json.loads(get_safe_cache("save_query_{}".format(request.user.pk)) or "[]"))
def get(self, request):
return Response([{"hey": "hi"}])