eve-sqlalchemy icon indicating copy to clipboard operation
eve-sqlalchemy copied to clipboard

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

Open postrational opened this issue 9 years ago • 9 comments

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

postrational avatar Jan 25 '16 14:01 postrational

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

lingfish avatar May 20 '16 09:05 lingfish

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 avatar Mar 12 '17 09:03 dkellner

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.

dkellner avatar Mar 17 '17 15:03 dkellner

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 avatar Mar 31 '17 10:03 tom95

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

dkellner avatar Apr 07 '17 08:04 dkellner

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

pointtoken avatar Feb 07 '18 21:02 pointtoken

@tom95 @dkellner Any update on this?

asif-intagleo avatar Aug 08 '19 16:08 asif-intagleo

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.

tom95 avatar Aug 08 '19 17:08 tom95

I actually rely on MongoDB

asif-intagleo avatar Aug 08 '19 18:08 asif-intagleo