query_children error when sqlamp Node is subclass of non-Node model

Issue #12 new
created an issue

The attached test case creates two sqlalchemy declarative classes, a BaseCollection class that is not a sqlamp node, and a subclass HierarchicalCollection that is a sqlamp node.

The intention is that instances of BaseCollection are just simple collections of items (the Item is not implemented), and a BaseCollection may not contain other collections. The sqlamp node, HierarchicalCollection, is a collection that may contain other HierarchialCollection objects, as well as being associated with items.

The problem is that after inserting a BaseCollection (coll) and a HierarchicalCollection (root) with a child HierarchicalCollection (child), the last line of the test below, which gets all children of the root (expecting just child in results), returns instances of both the BaseCollection and the HierarchicalCollection, instead of just returning HierarchicalCollection objects that are children of root (the child object).

I verified that the test case attached fails with the same behavior under sqlite3 and postgres 9.2.4.

The docstring at the top of the attached test case gives the sqlite tables and data that the test case creates, and shows the sqlalchemy engine output that shows the incorrect SQL that is generated for the query_children call.

Comments (0)

  1. Log in to comment