This is for Web/React sdk 20.0.0
The row was created via TableDB.createRow(...) and I can see it in the console with the relationships correctly set. In the console row, I can get the JSON and the data is all there, but getting the row with the TableDB.getRow() api, the response does not include the many relationship attribute arrays. They are not even there at all, not empty, not null, just not there. The docs don't help... any ideas?
#TableDB.getRow() response does not contain relationship arrays?
10 messages · Page 1 of 1 (latest)
Thanks for the tip, @cloud estuary, unfortunately, it does not to anything to the response, relationships continue not to be there:
```list: async (queries = [Query.select(['*'])]) =>
await tablesDB.listRows({
databaseId: APPWRITE_CATALOG_DATABASE_ID,
queries,
tableId: collection.id,
})```
Also tried the actual attribute names, but to no avail...
please check for correct permissions on related tables as well.
Yes, I have read on any and all permissions on admin, which I am logged in as to even access the dashboard.
await tablesDB.getRow({
databaseId: APPWRITE_CATALOG_DATABASE_ID,
queries,
rowId,
tableId: collection.id,
}),```
Interesting, I modified the query to actually enumerate all attributes:
Query.select([
'brand',
'categories',
'descripcion',
'description',
'images',
'name',
'nombre',
'reviews',
]),
])) as Product;```
In this list, **brand**, **categories**, **images**, and **reviews** are relationships.
And I get this error response:
```{
"message": "Cannot select attributes: brand, categories, images, reviews",
"code": 400,
"type": "general_query_invalid",
"version": "1.8.0"
}```
Which are precisely the relationships. Regardless, if I do not pass queries, **barnd** does come in the response, which is the only relationship that is not an array.
I too have had this same issue and assumed it was my misunderstanding of the new opt-in loading. I was expecting with the query ["*"] that I would get the ID's of the relationships. I would get the IDs for attributes that were relationship arrays but one-to-one relationships would not return that attribute at all unless I explicitly listed that attribute in the query. Not sure if it would help but I can do a full writeup with examples of my scenario but it sounds the exact same. I just went ahead and manually changed my query to be ["*", "*.owner"]. Feels janky but got it working for me for the time being.
Wow, @versed jetty, this was the clue! Thanks so much. The resulting schema is not what I expected, but it is all there. The query has to include the wildcard, otherwise selecting the relationship name throws an error. The resulting query is like this:
Query.select([
'*',
'brand',
'categories.*',
'descripcion',
'description',
'images.*',
'name',
'nombre',
'reviews.*',
]),
])) as Product;```
Also the wildcard and the attribute combination does not work if the attribute does not specify fields, nothing comes.
This does not return an images array at all:
Query.select([
'*',
'images',
]),
])) as Product;```
This does:
```const product = (await db.Product.get(editId, [
Query.select([
'*',
'images.*',
]),
])) as Product;```