title: sqlalchemy: Undo MetaData.remove(table)
body: <p>For some quite complex unit testing environment, we want to dynamically change the tables contained in the metadata. Removing tables from it are supported using <code>.remove(table)</code> or even <code>.clear()</code>. But how to later re-add such a table?</p>
  
  <p>There is a <code>_add_table(name, schema)</code> method in MetaData, but this doesn't seem to be the official way. Also the <code>Table._set_parent(metadata)</code> seems more appropiate if one has to go the "use internal methods" route.</p>
  
  <p>There also is <code>Table.tometadata(metadata)</code> which creates a new table instance that is attached the the new metadata. So I could create a complete new metadata and attach all "now needed" tables. But that would mean all the remaining code would need to know about the new table instances, connected to the new metadata. I don't want to go this route.</p>
  
  <p>UPDATE: We're now considering fork/multiprocessing to load the tables only in a subprocess (isolated environment) so that only that subprocess is "tainted" and the next tests wont be hurt. I am noting this here for completeness, it's no strictly related to the main question, but might help others who find this question.</p>