Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
4 Risposte
24856 Visualizzazioni

I need to know for each module of OpenERP 7 what are its tables assiciated in PostgreSQL.

Avatar
Abbandona
Autore

Ok, Thank you Sir.

select table_name, table_type, table_catalog from information_schema.tables where table_schema = 'public'

Risposta migliore

PostgreSQL tables are not related to modules. They are related to OpenERP models, like sale.order or stock.move. Every module can have zero-to-many models.

The table names are generated by using the model names and replacing all . by _. For example the table name of sale.order is sale_order.

It is not possible to assign each database table to a specific module because many tables are used by different modules and there are about 600 tables.

Avatar
Abbandona
Risposta migliore

We use http://schemaspy.sourceforge.net/ to help visualize the tables in the database, understand their dependencies and suggest which tables should be populated before others - accounting information before products and partners for example.

ORM manages the persistence of data inside PostgreSQL. As others are posting, which tables are used depends a lot on python code in many different places.

Another method we use to understand the tables involved is to set the server to log the SQL requests.

Avatar
Abbandona
Risposta migliore

A bit late, but for future reference since I ran into the same question.

psql -l

Avatar
Abbandona
Risposta migliore

You can see all the tables in postgres by connecting to your database and listing the tables.

sudo su - postgres
psql -d yourdatabase

now type this command to list all the tables in a DB

/dt

If you look in the python file for the associated module, it will list the models for that module. The models translate into tables in postgres. The model name will be changed from model.name to model_name

A module is not required to have tables, so there might be no tables for some modules.

Avatar
Abbandona

how to get the database name?