So foreignkey... i never understood what it is about.Also, i noted that your relation is not lazy. Is this of any importance?
hmmm. i'm on version 0.3.3. and for me, the Employee->Employee version also fails: Column's Foreignkey is on Employee; relation is on Employee class and primaryjoin is on employee_table. It dies when attempt to access a.manager:(in this case the "Manager" version is the one that fails).
...sqlalchemy.exceptions.SQLError: (OperationalError) no such column: Employee.id 'SELECT p_union.bonus AS p_union_bonus, p_union.atype AS p_union_atype, p_union.manager_id AS p_union_manager_id, p_union.name AS p_union_name, p_union.id AS p_union_id \nFROM "Employee", (SELECT CAST(NULL AS TEXT) AS bonus, anon_f706.manager_id AS manager_id, anon_f706.atype AS atype, anon_f706.id AS id, anon_f706.name AS name \nFROM (SELECT "Employee".id AS id, "Employee".name AS name, "Employee".atype AS atype, "Employee".manager_id AS manager_id \nWHERE "Employee".atype = ?) AS anon_f706 UNION ALL SELECT "Manager".bonus AS bonus, "Employee".manager_id AS manager_id, "Employee".atype AS atype, "Manager".id AS id, "Employee".name AS name \nFROM "Employee" JOIN "Manager" ON "Manager".id = "Employee".id) AS p_union \nWHERE "Employee".manager_id = ? ORDER BY p_union.oid' ['Employee', 1]
see test_case2.py Essentialy it is a self-referential mapper being inherited.Removing all Manager stuff (but keep a polymorphic_join over one item), and it still dies:
...sqlalchemy.exceptions.SQLError: (OperationalError) no such column: Employee.id 'SELECT p_union.atype AS p_union_atype, p_union.manager_id AS p_union_manager_id, p_union.name AS p_union_name, p_union.id AS p_union_id \nFROM "Employee", (SELECT anon_c397.manager_id AS manager_id, anon_c397.atype AS atype, anon_c397.id AS id, anon_c397.name AS name \nFROM (SELECT "Employee".id AS id, "Employee".name AS name, "Employee".atype AS atype, "Employee".manager_id AS manager_id \nWHERE "Employee".atype = ?) AS anon_c397) AS p_union \nWHERE "Employee".manager_id = ? ORDER BY p_union.oid' ['Employee', 1]
see test_case2b.pyOf course now it's a degenerated useless case - no need for the polymorphic_join as such; without it all works.
In fact until I saw this example I didnt think there was ever a reason you'd need to use "foreignkey" right now provided the Table's had proper ForeignKeys on them (self-referential mappers use "remote_side" now).
what is this remote_side? how it applies to above ? when i have to use remote_side and when foreign_key? ciao svil --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
test_case2.py
Description: application/python
test_case2b.py
Description: application/python