Skip to content

Document Django Debug types #513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 48 additions & 14 deletions graphene_django/debug/sql/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,53 @@


class DjangoDebugSQL(ObjectType):
vendor = String()
alias = String()
sql = String()
duration = Float()
raw_sql = String()
params = String()
start_time = Float()
stop_time = Float()
is_slow = Boolean()
is_select = Boolean()
class Meta:
description = (
"Represents a single database query made to a Django managed DB."
)

vendor = String(
required=True,
description=(
"The type of database being used (e.g. postrgesql, mysql, sqlite)."
),
)
alias = String(
required=True,
description="The Django database alias (e.g. 'default').",
)
sql = String(description="The actual SQL sent to this database.")
duration = Float(
required=True,
description="Duration of this database query in seconds.",
)
raw_sql = String(
required=True,
description="The raw SQL of this query, without params.",
)
params = String(
required=True,
description="JSON encoded database query parameters.",
)
start_time = Float(
required=True,
description="Start time of this database query.",
)
stop_time = Float(
required=True,
description="Stop time of this database query.",
)
is_slow = Boolean(
required=True,
description="Whether this database query took more than 10 seconds.",
)
is_select = Boolean(
required=True,
description="Whether this database query was a SELECT.",
)

# Postgres
trans_id = String()
trans_status = String()
iso_level = String()
encoding = String()
trans_id = String(description="Postgres transaction ID if available.")
trans_status = String(description="Postgres transaction status if available.")
iso_level = String(description="Postgres isolation level if available.")
encoding = String(description="Postgres connection encoding if available.")
8 changes: 7 additions & 1 deletion graphene_django/debug/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@


class DjangoDebug(ObjectType):
sql = List(DjangoDebugSQL)
class Meta:
description = "Debugging information for the current query."

sql = List(
DjangoDebugSQL,
description="Executed SQL queries for this API query.",
)