You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into an issue when trying to query both sides of a many-to-many relationship.
This happens both on version 3.1.0-alpha.1 and 3.1.0-alpha.9 (with the most recent #453 fixes)
As you can see, storageBags->distributedBy returns empty set, even though it's just the owning side of distributionBuckets->distributedBags many-to-many relationship, as defined by the schema:
typeDistributionBucket@entity {
"Runtime bucket id"id: ID! # ..."Bags assigned to be distributed by the bucket"distributedBags: [StorageBag!] @derivedFrom(field: "distributedBy")
}
typeStorageBag@entity {
"Storage bag id"id: ID! # ..."Distribution buckets assigned to distribute the bag"distributedBy: [DistributionBucket!]
}
Other observations:
There is a distribution_bucket_storage_bag (notice the inverse side table name goes first) table generated in the procesor database in order to support distributionBucket->storageBag many-to-many relationship. For storageBucket->storageBag the table name is storage_bag_storage_bucket (notice the owning side table name goes first). For some reason this turns out to be inline with which side of the relationship is available when querying, so:
storageBuckets->storedBags doesn't work (returns empty set)
storageBags->storedBy works
distributionBuckets->distributedBags works (as shown above)
storageBags->distributedBy doesn't work (empty set)
The text was updated successfully, but these errors were encountered:
I inspected the problem when working on relation filtering as it seemed related. It appears that the problem is not in the code of Hydra or Warthog, but rather somewhere deeper (Apollo server mb?). The first query finding storageBags originates in our code and seems to work fine. After that, a query (or queries) that tries to find the related objects generates valid SQL as seen in the console but fails to return a valid result to the graphql server. Maybe the problem is with mapping SQL results to typeorm object - naming of columns return by SQL query is different than what is expected by typeorm(?).
I'm running into an issue when trying to query both sides of a many-to-many relationship.
This happens both on version
3.1.0-alpha.1
and3.1.0-alpha.9
(with the most recent #453 fixes)Setup:
query-node
workspacedocker-compose build joystream-node
docker-compose up -d joystream-node
yarn && yarn workspace @joystream/types build && yarn workspace @joystream/metadata-protobuf build && yarn workspace query-node-root build
./query-node/start.sh
./distributor-node/scripts/test-commands.sh
Example query:
Expected result:
Actual result:
As you can see, storageBags->distributedBy returns empty set, even though it's just the owning side of distributionBuckets->distributedBags many-to-many relationship, as defined by the schema:
Other observations:
There is a
distribution_bucket_storage_bag
(notice the inverse side table name goes first) table generated in the procesor database in order to supportdistributionBucket->storageBag
many-to-many relationship. ForstorageBucket->storageBag
the table name isstorage_bag_storage_bucket
(notice the owning side table name goes first). For some reason this turns out to be inline with which side of the relationship is available when querying, so:storageBuckets->storedBags
doesn't work (returns empty set)storageBags->storedBy
worksdistributionBuckets->distributedBags
works (as shown above)storageBags->distributedBy
doesn't work (empty set)The text was updated successfully, but these errors were encountered: