Query.select ["attribute name.*"] doesn't return the attribute if it's a relationship
- 0
- Databases
- Flutter
My document have a relationship "source"
If I query without doing a select, source is present in the attributes.
But if I do: Query.select( ["title", ..., "source.* ", ...systemAttributes]);
Based on this https://github.com/appwrite/appwrite/issues/5657, it should work.
But in my case, every attributes I include are present except the relationship one which is "source".
If I do : Query.select(["source.* ", ...systemAttributes]):
I have documents like this:
{$id: 6609f1fa3031203835fb, $createdAt: 2024-03-31T23:30:03.205+00:00, $updatedAt: 2024-03-31T23:30:03.205+00:00, $permissions: []}
Basically, source is never included.
But I know that at least the server recognize the request since doing it wrongly throw an error instead.
Query.select(["source", ...systemAttributes]):
Any idea?
No queries work on relationships
🧐 I'm confused, why would appwrite Engineering Lead suggest a solution that doesn't actually work?
I mean, it's not even a suggestion, it's presented as though it is the actual solution to this specific isue then the github issue was marked as completed without any mention of this not actually working or being something that should be present in the future, not the present day.
Maybe someone from the core team will have to come and check this out. It could be a bug that that doesn’t work. I’m not entirely sure.
I can throw together a POC sometime tomorrow to verify I get the same behavior
Let me know if I'm missing something, but here is my POC, and it looks like it's working.
Here is my stackblitz. It's in the page test.svelte
Sorry for the late response, I am on vacation.
Can you possibly try this POC again on with the flutter appwrite package version 11.0.1? Or I can post my own barebone code on github. I tried again with the most barebone implementation client side (but still the same project server side), but I'm still getting the same issue:
With this query : Query.select(["source.*", ...systemAttributes]);
I have this this result :
{$id: 65df580ee8de480290fd, $createdAt: 2024-02-28T15:58:06.956+00:00, $updatedAt: 2024-02-28T15:58:06.956+00:00, $permissions: []}
The source is still nowhere to be seen, but I know at least that the server do recognize the query since if I mispell "source", for example in this query : Query.select(["fakeSource.*", ...systemAttributes]);
I have this error :
AppwriteException: general_query_invalid, Invalid query: Attribute not found in schema: fakeSource (400)#0
Also, the reason why I'm not directly sharing the code is because I'm on a very limited network currently but if it's needed to help resolve this issue, I will do it.
What I really don't know is wether the appwrite package is tampering with the server response somehow or is the server just not giving the appropriate response back depending on the client that's requesting (maybe this specific feature is disabled for this specific appwrite version I don't know, but I think that's odd and probably not the case given the date of the github posts and responses.)
@paritodev is this a related PR that could fix your issue? I think this involves making querying relational data work, as well as fixing a few other issues with relationships https://github.com/utopia-php/database/pull/400
Recommended threads
- Type Mismatch in AppwriteException
There is a discrepancy in the TypeScript type definitions for AppwriteException. The response property is defined as a string in the type definitions, but in pr...
- [SOLVED] OAuth With Google & Flutter
Hi all, I'm trying to sign in with google and it all goes swimmingly until the call back. I get a new user created on the appwrite dashboard however the flutte...
- What Query's are valid for GetDocument?
Documentation shows that Queries are valid here, but doesn't explain which queries are valid. At first I presumed this to be a bug, but before creating a githu...