title: Many to Many with Multiple Parents in SQLAlchemy
body: <p>I'm not sure the title is correct so let me give an example</p>
  
  <p>Say I have <code>TableA</code> and <code>TableB</code> classes, and a <code>History</code> class.</p>
  
  <p><code>History</code> would just be <code>id, attribute, old value, new value</code>.</p>
  
  <p>Each Table would have a many-many relationship with <code>History</code>.</p>
  
  <p>Obviously I can create a <code>tablea_history</code> and <code>tableb_history</code> table to keep track of the relationships. </p>
  
  <p>However I'm going to have 5-10 <code>TableA/B</code> type tables and 3-4 <code>History</code> type tables so that adds up to quite a bit of simple relationship tables. Is that okay? (In both management and efficiency?) It seems like that would add a lot of extra code.</p>
  
  <p>I could also have a <code>History</code> defined by <code>id, table_name, attribute, old, new</code> but then I wouldn't know how create nice SQLAlchemy relationships.</p>
  
  <p>TL;DR</p>
  
  <p>I guess I am asking what is the best way to associate a child table to multiple kinds (different classes) of parent tables that lets me not worry about the behind the scenes stuff and just use nice SQLalchemy relationships.</p>