python module for data comparison of 2 MySQL servers
tino at wildenhain.de
Fri Sep 4 12:57:58 CEST 2009
Am 02.09.2009 02:00, schrieb none:
> I have 2 MySQL servers in 2 different data centers.
> Between them, there is data replication setup.
> Is there a python tool so I can do data comparison for daily records?
Why should the data differ and the replication not detect and correct
it? I frequently hear that MySQL has such a sophisticated replication...
> Basically, just access both servers and do a diff in memory and print
> out records.
I'd not do this in memory since any database of resonably size can
quickly have more then your work mem data in a table and in this
case you would have it twice.
You could start with connections to both databases
and select * from table order by [primary keys or all columns]
and then use difflib.SequenceMatcher on both cursors
(they should be iterable)
keep in mind that depending on your replication type
the databases could differ by the exact time you start your
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3254 bytes
Desc: S/MIME Cryptographic Signature
More information about the Python-list