Hello. I'm having trouble mapping a relationship on a column_property.
A similar problem has been reported in an old post on this mailing list, but with no answers: http://groups.google.com/group/sqlalchemy/browse_thread/thread/f7a13d9ca1494060/6fe890bb49c8dfa8#6fe890bb49c8dfa8 I have a column containing a code, a substring of this code refers to another table's primary key. I tried the following solutions, but none works: 1) "Naive" joining on the attributes: Table1.rel_to_table2 = relationship(Table2, viewonly=True, uselist=False, primaryjoin=func.substring(Table1.code, 1, 3) == Table2.code) 2) Defining an intermediate column property: Table1.table2_code = column_property(func.substring(Table1.col1, 1, 3)) Table1.rel_to_table2 = relationship(Table2, viewonly=True, uselist=False, primartyjoin=Table1.table2_code == Table2.code) 3) Adding a foreign_keys argument to the relationship, on the actual columns This results in an error: sqlalchemy/orm/properties.py", line 1458, in _refers_to_parent_table pt.is_derived_from(c.table) and \ AttributeError: 'Function' object has no attribute 'table' Thank you! -- Ronan Dunklau -- 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 sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.