#28 polymorphic inheritance seems broken or uncomplete

inheritance (1)

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



Cancel   Add attachments