When trying to automap legacy database which has some issues with foreign key naming I ran into following issue.
Having following two tables, it barfs because of naming conflict between column
table_b.table_a and relationship
table_a: id table_b: id table_a (foreign key to table_a.id)
Error message nicely tells me to
To resolve this, map the column to the class under a different name in the 'properties' dictionary., but automap part of documentation doesn't mention much about this case.
I have tried to override the class generation using following constructs, but still fail with error above:
class Table_B(Base): __tablename__ = 'table_b' table_a = Column(ForeignKey('table_a.id'))