title: How to find out the table name for a many2many relation (Where is the many2many table name stored?)
body: <p>I am trying to recover data from a broken Odoo installation (uprade got screwed up).</p>
  
  <p>I have exported all the tables to CSV using postgresql (psql). I would also be able to handle many2one and one2many relations.</p>
  
  <p>For many2many relations, I need a way to programatically find out which database table contains the relation details (ids from both the models). I tried to get the data from the ORM "fields_get" function using xmlrpc. The  field definition returns a dictionary which has a key named 'relation'. However this key contains just the name of the other table/ model involved in the relation. For many2many relations there is another 3rd table involved. I am unable to find where odoo stores the name of this table.</p>
  
  <p>Example data:
  Let me try to explain my question using an example: In res_partner.py the field category_id is defined as :</p>
  
  <pre><code>'category_id': fields.many2many('res.partner.category', id1='partner_id', id2='category_id', string='Tags')`
  </code></pre>
  
  <p>Based on this a new table would be created by Odoo which would hold the many2many relation details. The name of this table is automatically selected by Odoo. I need to know that table name for each many2many field I encounter.</p>
  
  <p>The 'fields_get' function returns the following for this field:</p>
  
  <pre><code>'category_id': {'domain': [], 'change_default': False, 'string': 'Tags', 'searchable': True, 'required': False, 'manual': False, 'depends': [], 'readonly': False, 'relation':'res.partner.category', 'context': {}, 'company_dependent': False, 'sortable': True, 'type': 'many2many', 'store': True}
  </code></pre>
  
  <p>The name of the table is not mentioned here. I need that to create a small script to read and export data out of my non-functional odoo instance. When Odoo is running, how does it know which table to read for any many2many relation?</p>
  
  <p>Regards,</p>
  
  <p>Tanveer</p>