Re: [sqlalchemy] Polymorphic relationships to different classes

2019-08-30 Thread Simon King
There is a section in the SQLAlchemy docs that deals with this: https://docs.sqlalchemy.org/en/13/orm/examples.html#module-examples.generic_associations The first three examples in that section use different table structures so that you can use proper database-level foreign keys to maintain

[sqlalchemy] Polymorphic relationships to different classes

2019-08-29 Thread YKdvd
Suppose I have two distinct and unrelated ORM classes, call them Powers, and Dominions (which are in tables "powers" and "dominions", both having an "id" field), and I want them both to have relationships to their own subclass of a single-table polymorphic setup, call it Things. class