Rounak Jain
2018-01-07 08:48:53 UTC
Let me clarify what I mean by master and slave (since googling this issue
takes me to psql master slave replication which is probably different).
I work with the slave db to create invoices with my python cli app.
I have created a master db by using
create database master with template slave owner owner_name;
For now, both db contain the same data and structure.
Now, I will delete all data from tables like sale_invoice,
sale_invoice_detail etc but not from tables like customer, product etc.
I may create new entries in tables like customer, product etc or modify
existing ones. I will create new invoices which shall insert new records in
sale_invoice and sale_invoice_details table.
I want to be able to:
1. Add new entries created in customer, product tables to the master db
2. Modify old entries if they are modified in the slave db
3. Add new data to sale_invoice and sale_invoice_detail tables in the
master db when new invoices are created in the slave db
I assume, I can do all this by matching primary keys and using
insert/update but I want to know if there are better ways to do this.
Thanks.
takes me to psql master slave replication which is probably different).
I work with the slave db to create invoices with my python cli app.
I have created a master db by using
create database master with template slave owner owner_name;
For now, both db contain the same data and structure.
Now, I will delete all data from tables like sale_invoice,
sale_invoice_detail etc but not from tables like customer, product etc.
I may create new entries in tables like customer, product etc or modify
existing ones. I will create new invoices which shall insert new records in
sale_invoice and sale_invoice_details table.
I want to be able to:
1. Add new entries created in customer, product tables to the master db
2. Modify old entries if they are modified in the slave db
3. Add new data to sale_invoice and sale_invoice_detail tables in the
master db when new invoices are created in the slave db
I assume, I can do all this by matching primary keys and using
insert/update but I want to know if there are better ways to do this.
Thanks.