Skip to content

Commit

Permalink
Merge pull request #23 from mongkok/fix/add-sql-encoder
Browse files Browse the repository at this point in the history
Add SQL query encoder
  • Loading branch information
mongkok authored Dec 11, 2022
2 parents e6fdb73 + 68bb115 commit 8849927
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion debug_toolbar/panels/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import sqlparse
from fastapi import Request, Response
from fastapi.encoders import jsonable_encoder
from pydantic.color import Color
from sqlparse import tokens as T

Expand Down Expand Up @@ -105,7 +106,7 @@ def add_query(self, alias: str, query: t.Dict[str, t.Any]) -> None:
self._databases[alias]["num_queries"] += 1

self._sql_time += duration
self._queries.append((alias, query))
self._queries.append((alias, jsonable_encoder(query)))

async def generate_stats(self, request: Request, response: Response) -> Stats:
trace_colors: t.Dict[t.Tuple[str, str], Color] = defaultdict(
Expand Down

0 comments on commit 8849927

Please sign in to comment.