pyeve / eve-sqlalchemy

SQLAlchemy data layer for Eve-powered RESTful APIs
http://eve-sqlalchemy.readthedocs.io
Other
232 stars 70 forks source link

Embedding nested relationships (embedded={"doc.subdoc":1}) not working #100

Open postrational opened 8 years ago

postrational commented 8 years ago

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

lingfish commented 8 years ago

+1. I'd like to know this too.

dkellner commented 7 years ago

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.

dkellner commented 7 years ago

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.

tom95 commented 7 years ago

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

dkellner commented 7 years ago

@tom95 Thank you for sharing this! A proper fix for this would be awesome, of course! :)

pointtoken commented 6 years ago

Any update on this? It appears nested querying in eve is still broken...

asif-intagleo commented 5 years ago

@tom95 @dkellner Any update on this?

tom95 commented 5 years ago

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.

asif-intagleo commented 5 years ago

I actually rely on MongoDB