Matias Palomera
Matias Palomera

Reputation: 137

Compare two databases using Django and create a third one with the result?

I am developing a website using Django and I need to compare two databases.

With the differences found I want to create a third table in memory to later use. To give you an idea.

Table1:
------------
|ID | Name |
------------
| 1 |  A   |
------------
| 2 |  B   |
------------
| 3 |  C   |
------------

Table2:
------------
|ID | Name |
------------
| 1 |  A   |
------------
| 2 |  R   |
------------
| 3 |  G   |
------------

ResultTable:
------------
|ID | Name |
------------
| 2 |  R   |
------------
| 3 |  G   |
------------

How can I do this?

Upvotes: 1

Views: 342

Answers (1)

user554538
user554538

Reputation:

You can define multiple database connections in Django. Then, you can issue queries on each connection, and use difflib to get differences in rows between the results, and put them into another table in another database.

Upvotes: 1

Related Questions