I'm not sure I understood your question correctly as I'm very new to
sqlalchemy, still I thought u need to know how to declare ForeignKeys
in declarative style. Here is how u can declare it ; for example,
suppose you have 2 tables -
class A(Base):
__tablename__ = 'a_table'
id =
Thanks for your help. Sorry if I wasn't clear. I was referring to the
foreign_keys keyword argument to relationship, not to ForeignKey. Here is a
link to the relevant doc:
http://www.sqlalchemy.org/docs/orm/relationships.html?highlight=relationship#sqlalchemy.orm.relationship
Thanks,
Michael
On
if you're on declarative then you can say
foreign_keys=MyRelatedCls.related_id or
foreign_keys=[MyRelatedCls.related_id] , all as a string, not a list of
strings. You can also send the declarative attribute right in,
foreign_keys=MyRelatedClass.related_id. Also I think cls.__mapper__.c has