Menu

#28 polymorphic inheritance seems broken or uncomplete

open
nobody
inheritance (1)
2015-11-18
2014-08-21
Oliver
No

I am researching several ODMs for our project.

First of all: project documentation on this topic is really bad, also code documentation and comments are missing.

I have found hints at https://github.com/behackett/presentations/tree/master/pycon_2012 (which seems outdated) and in the unit tests.

I attach a pytest unit test which shows my assertions.

  1. Problem: if I query a subclass for all instances with find, I get also the instances from the superclass

  2. Expectation: I get only those instances, which belong to my subclass

  3. Problem: if I query one instance from the subclass with get, I get the instance from the superclass

  4. Expectation: I get the instance from the subclass

Generally it seems that I have always to add kind=<polymorphic_identity> to get it right, but that would mean, that I have to take care of the inheritance chain and make as many queries as subclasses are defined. Such things I would expect the ODM to resolve.

Since the documentation is so sparse, it is also possible that I am totally wrong, so I ask you to point me in the right direction.

1 Attachments

Discussion

  • Anonymous

    Anonymous - 2015-11-18

    Same problem here!
    In my eyes, a query on a subclass should only return instances of this class and its subclasses

     

Anonymous
Anonymous

Add attachments
Cancel