tags:

views:

69

answers:

2

i have to parse a very complex dumps(whatever it is), i have done the parsing thruogh python.since the parsed data is very huge in amount, i have to feed it in the database (SQL), I have also done this... now the thing is i have to compare the data now present in the sql.

in actual i have to compare the data of 1st dump with the data of the 2nd dump..... the both dump have the same fields(attributes) but the values of their field may be change... so i have to detect this change.. for this i have to do the comparison... but i dont have the idea how to do this all using python as my front end.

plz plzzzz help me:(

A: 

Why not do the 'dectect change' in SQL? Something like:

select foo.data1, foo.data2 from foo where foo.id = 'dump1'
minus
select foo.data1, foo.data2 from foo where foo.id = 'dump2'
TML
Some database engines implement this functionality with the keyword `EXCEPT`, rather than `MINUS`
Ed Harper
+1  A: 

If you don't have MINUS or EXCEPT, there is also this, which will show all non-matching rows using a UNION/GROUP BY trick

SELECT MAX(table), data1, data2
FROM (
    SELECT 'foo1' AS table, foo1.data1, foo1.data2 FROM foo1
    UNION ALL
    SELECT 'foo2' AS table, foo2.data1, foo2.data2 FROM foo2
) AS X
GROUP BY data1, data2
HAVING COUNT(*) = 1
ORDER BY data1, data2

I have a general purpose table compare SP which also can do a more complex table compare with left and right and inner joins and monetary threshold (or threshold percentage) and subset criteria.

Cade Roux