Some basic sql command
SELECT id, name, is_attribute
FROM product_template
WHERE id IN (97, 98, 103);
SELECT *
FROM billing_product_attribute_rel
LIMIT 10;
SELECT p.id AS product_id, p.name AS product_name, attr.id AS attribute_id, attr.name AS attribute_name
FROM billing_product_attribute_rel rel
JOIN product_template p ON rel.src_id = p.id
JOIN product_template attr ON rel.dest_id = attr.id
WHERE attr.is_attribute = TRUE;
Use pg_dump to Download the Database:
pg_dump -h <host> -p <port> -U <username> -d <database_name> -F c -b -v -f <output_file>.dump
<host>: The host where your Odoo server is running.
<port>: The port PostgreSQL is using (usually 5432).
<username>: The username you use to connect to the database.
<database_name>: The name of your Odoo database.
<output_file>: The name of the file you want to save the database backup as.
For example:
pg_dump -h 192.168.1.100 -p 5432 -U odoo_user -d odoo_db -F c -b -v -f odoo_backup.dump
You'll be prompted for the password for the PostgreSQL user.
Restore the Backup on Your Local Machine:
Once the backup is downloaded, you can restore it locally if you want to set up an Odoo instance on your local machine.
Use pg_restore to restore the database to a local PostgreSQL instance:
pg_restore -h localhost -p 5432 -U <local_username> -d <local_database_name> -v <output_file>.dump
<local_username>: The username for your local PostgreSQL instance.
<local_database_name>: The name of the local database you want to restore to.
<output_file>: The backup file you downloaded.