Torii graphql to use JOIN instead of subqueries to return custom types data
When querying for models with custom types there are inefficiencies due to how queries are executed. This ticket tracks this todo item here: https://github.com/dojoengine/dojo/blob/c2687e8fd18a51bf5ed1e67997dd7db0853c5643/crates/torii/graphql/src/object/model_data.rs#L175
Parent query: https://github.com/gianalarcon/dojo/blob/8de715d8691d987629948002fb8ba96d36b9990e/crates/torii/graphql/src/query/data.rs#L37
Hello, I'll be interested about working on this one :)
Sure! It's somewhat non-trivial as we build the graphql schema dynamically at runtime but feel free to reach out with any questions.
Here's the parent query: https://github.com/dojoengine/dojo/blob/b03bfb8d565d4d81b5afb98784d07741ca4d4f85/crates/torii/graphql/src/object/model_data.rs#L249
@azurwastaken are you still planning to work on this?
I can take this, we chatted offline and @azurwastaken will help with implementing some of the graphql testing
Hi team. Any updates for this issue. Otherwise I would like to give it a try
Ah I haven't gotten to it yet, all yours!
Sure! It's somewhat non-trivial as we build the graphql schema dynamically at runtime but feel free to reach out with any questions.
Here's the parent query:
https://github.com/dojoengine/dojo/blob/b03bfb8d565d4d81b5afb98784d07741ca4d4f85/crates/torii/graphql/src/object/model_data.rs#L249
It seems like there is no parent query anymore. Now we have fn fetch_multiple_rows() instead https://github.com/gianalarcon/dojo/blob/8de715d8691d987629948002fb8ba96d36b9990e/crates/torii/graphql/src/query/data.rs#L37
@broody Can you confirm it and update the issue? Thanks
It seems like there is no parent query anymore. Now we have fn fetch_multiple_rows() instead https://github.com/gianalarcon/dojo/blob/8de715d8691d987629948002fb8ba96d36b9990e/crates/torii/graphql/src/query/data.rs#L37
@broody Can you confirm it and update the issue? Thanks
Yeah, it's been generalized so could be used by all objects.
The challenge for model_data objects with nested types is after JOIN we get this flat sqlite row, connection_output will need to convert it properly to its value mapping with all the nested data.
@broody is this still active?
@broody is this still active?
Yes, we're gonna consolidate the queries from grpc and graphql which will resolve this issue.
Will close to have consolidation follow up in #1395.