eve-sqlalchemy
eve-sqlalchemy copied to clipboard
Embedding nested relationships (embedded={"doc.subdoc":1}) not working
Hi,
I have three related tables. I would like to make an Eve query which would embed a list of objects from table2 related to my selected object from table1. I can build a query like so:
/eve/table1/1?embedded={"table2":1}
That works like a charm.
However, when I try to embed another list of objects from table3 related to objects from table2 related to the original object, using a query like this:
/eve/table1/1?embedded={"table2.table3":1}
then I get a response with no embedding at all.
I am doing something wrong, or is this feature not yet implemented?
I'm trying to follow instructions from the Eve website: http://python-eve.org/features.html#limitations
+1. I'd like to know this too.
A lot of things changed sinced this issue was created so we need to confirm this one again. Preferrably with a minimal (failing/working) example.
I can confirm this is an issue. The relevant test in Eve is TestGet.test_get_reference_embedded_in_subdocuments
. At the moment we skip this one in Eve-SQLAlchemy.
So the next step is to take a closer look at this test. I'm afraid we have to copy it and amend it a little, as it uses the MongoDB directly and not the data layer abstraction.
On the off chance that it helps the future implementer, we urgently needed this functionality just now and after short investigation it turned out to be already supported in eve-sqlalchemy, however eve wasn't passing enough information to eve-sqlalchemy for it to resolve everything.
I created a fork over here https://github.com/tom95/eve/tree/nested-embedded that contains the "fix" in eve, but currently breaks the mongodb backend. If I find more time soon, I may investigate a proper fix, if anyone beats me to it I'm looking forward to dropping my fork again and use a real solution :)
Direct link to the changes: https://github.com/tom95/eve/commit/2397b28f7d6d10e880684fd54454e10ec92194ae
@tom95 Thank you for sharing this! A proper fix for this would be awesome, of course! :)
Any update on this? It appears nested querying in eve is still broken...
@tom95 @dkellner Any update on this?
Not from my side, sorry. I suppose you could migrate those changes if you don't rely on the mongodb backend to the newest eve version, again as a workaround.
I actually rely on MongoDB