On Feb 9, 2010, at 9:43 PM, Boda Cydo wrote: > Hello everyone! > > Please help me with this difficult problem. I can't find a solution > myself: > > Suppose that I have a table `Articles`, which has fields `article_id`, > `content` and it contains one article with id `1`. > > I also have a table `Categories`, which has fields `category_id` > (primary key), `category_name`, and it contains one category with id > `10`. > > Now suppose that I have a table `ArticleProperties`, that adds > properties to `Articles`. This table has fields `article_id`, > `property_name`, `property_value`.
this sounds like joined table inheritance. Have you looked over http://www.sqlalchemy.org/docs/mappers.html#joined-table-inheritance ? Otherwise you may consider building a relation() from Article->ArticleProperties and a second from ArticleProperties->Categories. > > Suppose that I want to create a mapping from `Categories` to > `Articles` via `ArticleProperties` table. > > I do this by inserting the following values in the `ArticleProperties` > table: (article_id=1, property_name="category", property_value=10). > > Is there any way in SQLAlchemy to express that rows in table > `ArticleProperties` with `property_name` "category" are actually > FOREIGN KEYS of table `Articles` to table `Categories`? > > Any help appreciated! > > Thanks, Boda Cydo. > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@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. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@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.