[sqlalchemy] One-to-one relationship as a boolean flag

2015-07-07 Thread Pedro Werneck
Let's say I have a table 'user', and for backwards compatibility reasons I have a single-column table named 'user_active' which is basically just a foreign key used as a boolean flag. I need my User model to have the 'active' field as a boolean mapped to that one-to-one relationship. So, I

Re: [sqlalchemy] Polymorphic many (Messages) to one (User/Group) relationship

2015-07-07 Thread Fridtjof Mund
I'm sorry, forgot to include Message: class Message(Base): __tablename__ = messages id = Column(Integer, primary_key=True) type = Column(String) sender_id = Column(Integer, ForeignKey(users.id)) recipient_association_id = Column(Integer, ForeignKey(RecipientAssociation.id))