-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Self-reference fails with inheritance #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Michael Bayer (@zzzeek) wrote: not surprising at all, self-referential and polymorphic loading are separately the wackiest functions SA has. i have not even attempted testing self-ref together with just plain inheritance yet. querying shouldnt be too hard to fix, its saving the stuff thats really going to be a pain. ill get around to this soon. |
Changes by Michael Bayer (@zzzeek):
|
Michael Bayer (@zzzeek) wrote: gonna mark it as fixed. changeset:1552 commits a pretty aggressive unit test for this, which is found here: browser:sqlalchemy/trunk/test/poly_linked_list.py, with most of the work being in changeset:1548, changeset:1550. Note that with the polymorphic union in use as well as the circular dependency, eager loading is off the table for now; even though the test says "lazy=False", those eager loads degrade to lazy loads when the queries are constructed (which also is something nice to test, that nothing breaks when eager loading is not possible). This test tests joined table and single table inheritance simultaneously among four different classes, as well as an extra one-to-many on some other random object, querying a forwards and backwards traversal over a linked list structure that is stored in an adjacency list table. You can still create queries that will load a wider range of nodes (i.e. more "eagerly") and feed them into the mapper in a manner similar to the "byroot_tree" example which is at browser:sqlalchemy/trunk/examples/adjacencytree/byroot_tree.py. I hope to add some extra features soon to make custom SQL queries easier to construct for mappers, including customized eager load criterion. |
Changes by Michael Bayer (@zzzeek):
|
Migrated issue, originally created by Anonymous
The following program defines an inheritance relation between two tables. The base class also defines a self-reference. The program results in an error when executed.
Results in the following error:
It seems that the select_table and uselist=False don't go along.
Tested with SVN revision 1531.
The text was updated successfully, but these errors were encountered: