Merge pull request #513 from danpalmer/patch-2

Document Django Debug types
This commit is contained in:
Syrus Akbary 2018-09-09 22:49:01 +02:00 committed by GitHub
commit 3d493c3bd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 15 deletions

View File

@ -2,19 +2,53 @@ from graphene import Boolean, Float, ObjectType, String
class DjangoDebugSQL(ObjectType): class DjangoDebugSQL(ObjectType):
vendor = String() class Meta:
alias = String() description = (
sql = String() "Represents a single database query made to a Django managed DB."
duration = Float() )
raw_sql = String()
params = String() vendor = String(
start_time = Float() required=True,
stop_time = Float() description=(
is_slow = Boolean() "The type of database being used (e.g. postrgesql, mysql, sqlite)."
is_select = Boolean() ),
)
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 # Postgres
trans_id = String() trans_id = String(description="Postgres transaction ID if available.")
trans_status = String() trans_status = String(description="Postgres transaction status if available.")
iso_level = String() iso_level = String(description="Postgres isolation level if available.")
encoding = String() encoding = String(description="Postgres connection encoding if available.")

View File

@ -4,4 +4,10 @@ from .sql.types import DjangoDebugSQL
class DjangoDebug(ObjectType): 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.",
)