Skip to content

Commit 3d493c3

Browse files
authored
Merge pull request #513 from danpalmer/patch-2
Document Django Debug types
2 parents f4bbae2 + 040f6aa commit 3d493c3

File tree

2 files changed

+55
-15
lines changed

2 files changed

+55
-15
lines changed

graphene_django/debug/sql/types.py

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,53 @@
22

33

44
class DjangoDebugSQL(ObjectType):
5-
vendor = String()
6-
alias = String()
7-
sql = String()
8-
duration = Float()
9-
raw_sql = String()
10-
params = String()
11-
start_time = Float()
12-
stop_time = Float()
13-
is_slow = Boolean()
14-
is_select = Boolean()
5+
class Meta:
6+
description = (
7+
"Represents a single database query made to a Django managed DB."
8+
)
9+
10+
vendor = String(
11+
required=True,
12+
description=(
13+
"The type of database being used (e.g. postrgesql, mysql, sqlite)."
14+
),
15+
)
16+
alias = String(
17+
required=True,
18+
description="The Django database alias (e.g. 'default').",
19+
)
20+
sql = String(description="The actual SQL sent to this database.")
21+
duration = Float(
22+
required=True,
23+
description="Duration of this database query in seconds.",
24+
)
25+
raw_sql = String(
26+
required=True,
27+
description="The raw SQL of this query, without params.",
28+
)
29+
params = String(
30+
required=True,
31+
description="JSON encoded database query parameters.",
32+
)
33+
start_time = Float(
34+
required=True,
35+
description="Start time of this database query.",
36+
)
37+
stop_time = Float(
38+
required=True,
39+
description="Stop time of this database query.",
40+
)
41+
is_slow = Boolean(
42+
required=True,
43+
description="Whether this database query took more than 10 seconds.",
44+
)
45+
is_select = Boolean(
46+
required=True,
47+
description="Whether this database query was a SELECT.",
48+
)
1549

1650
# Postgres
17-
trans_id = String()
18-
trans_status = String()
19-
iso_level = String()
20-
encoding = String()
51+
trans_id = String(description="Postgres transaction ID if available.")
52+
trans_status = String(description="Postgres transaction status if available.")
53+
iso_level = String(description="Postgres isolation level if available.")
54+
encoding = String(description="Postgres connection encoding if available.")

graphene_django/debug/types.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@
44

55

66
class DjangoDebug(ObjectType):
7-
sql = List(DjangoDebugSQL)
7+
class Meta:
8+
description = "Debugging information for the current query."
9+
10+
sql = List(
11+
DjangoDebugSQL,
12+
description="Executed SQL queries for this API query.",
13+
)

0 commit comments

Comments
 (0)