This repository was archived by the owner on Jul 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
This repository was archived by the owner on Jul 8, 2023. It is now read-only.
more SQLs then expected #231
Copy link
Copy link
Open
Description
Hi,
Here is my schema and query. When I run the query, I get some extra SQL queries in Debug Toolbar, that seem unnecessary. Not sure what is invoking them and how to avoid them.
| + | SELECT ••• FROM "accounts_user" WHERE "accounts_user"."id" = '1' LIMIT 21 | | 2.24 | Sel Expl
| + | SELECT COUNT(*) AS "__count" FROM "marketplace_product" WHERE "marketplace_product"."author_id" = '1' | | 1.08 | Sel Expl
| + | SELECT ••• FROM "marketplace_product" WHERE "marketplace_product"."author_id" = '1' LIMIT 8 | | 0.41 | Sel Expl
| + | SELECT ••• FROM "marketplace_product" WHERE "marketplace_product"."id" = '659' LIMIT 21 7 similar queries. | | 0.36 | Sel Expl
| + | SELECT ••• FROM "marketplace_product" WHERE "marketplace_product"."id" = '660' LIMIT 21 7 similar queries. | | 0.34 | Sel Expl
| + | SELECT ••• FROM "marketplace_product" WHERE "marketplace_product"."id" = '661' LIMIT 21 7 similar queries. | | 0.34 | Sel Expl
| + | SELECT ••• FROM "marketplace_product" WHERE "marketplace_product"."id" = '662' LIMIT 21 7 similar queries. | | 0.37 | Sel Expl
| + | SELECT ••• FROM "marketplace_product" WHERE "marketplace_product"."id" = '663' LIMIT 21 7 similar queries. | | 0.35 | Sel Expl
| + | SELECT ••• FROM "marketplace_product" WHERE "marketplace_product"."id" = '664' LIMIT 21 7 similar queries. | | 0.62 | Sel Expl
| + | SELECT ••• FROM "marketplace_product" WHERE "marketplace_product"."id" = '665' LIMIT 21 7 similar queries. | | 0.46 | Sel Expl
3rd query gets me what I need (product's name), what are the queries below it?
Here are 4 last lines from Debug Toolbar stack tract:
/usr/local/lib/python3.11/site-packages/strawberry_django_plus/utils/resolvers.py in wrapper(103)
return resolver(*args, **kwargs)
/usr/local/lib/python3.11/site-packages/strawberry_django_plus/field.py in resolve_connection(335)
return super().resolve_connection(
/usr/local/lib/python3.11/site-packages/strawberry_django_plus/relay.py in resolve_connection(1079)
return return_type.from_nodes(nodes, **kwargs)
/usr/local/lib/python3.11/site-packages/strawberry_django_plus/relay.py in from_nodes(770)
edges = [edge_class.from_node(v, cursor=start + i) for i, v in enumerate(iterator)]#schema.py
@gql.django.type(User, filters=UserFilter, order=UserOrder)
class UserType(gql.relay.Node):
email: gql.auto
...
@gql.django.connection()
def products(self) -> List["ProductType"]:
return self.product_set.all()
@gql.django.type(Product, filters=ProductFilter, pagination=True)
class ProductType(gql.relay.Node):
name: gql.auto
...#query
query MyQuery {
user {
products {
edges {
node {
name
}
}
}
}
}Metadata
Metadata
Assignees
Labels
No labels