tablediff.py
changeset 56 94e091c23ebb
parent 41 6aad5e35efe8
child 83 515fadd3d286
--- a/tablediff.py	Thu Dec 13 17:15:10 2012 +0100
+++ b/tablediff.py	Mon Dec 17 16:48:12 2012 +0100
@@ -14,24 +14,24 @@
 
 class TableDiffTool(toolbase.SrcDstTablesTool):
     def __init__(self):
-        toolbase.SrcDstTablesTool.__init__(self, name='tablediff', desc='Table diff.')
-        
+        toolbase.SrcDstTablesTool.__init__(self, name='tablediff', desc='Table diff.', allow_reverse = True)
+
         self.parser.add_argument('--sql', action='store_true', help='Output is SQL script.')
         self.parser.add_argument('--rowcount', action='store_true', help='Compare number of rows.')
-        
+
         self.init()
 
     def main(self):
         srcconn = self.pgm.get_conn('src')
         dstconn = self.pgm.get_conn('dst')
-        
+
         dd = pgdatadiff.PgDataDiff(srcconn, dstconn)
-        
+
         for srcschema, srctable, dstschema, dsttable in self.tables():
             print('-- Diff from [%s] %s.%s to [%s] %s.%s' % (
                 self.args.src, srcschema, srctable,
                 self.args.dst, dstschema, dsttable))
-            
+
             if self.args.rowcount:
                 with self.pgm.cursor('src') as curs:
                     curs.execute('''SELECT count(*) FROM "%s"."%s"''' % (srcschema, srctable))
@@ -42,10 +42,10 @@
                 if srccount != dstcount:
                     print(highlight(1, BOLD | YELLOW), "Row count differs: src=%s dst=%s" % (srccount, dstcount), highlight(0), sep='')
                 continue
-            
+
             dd.settable1(srctable, srcschema)
             dd.settable2(dsttable, dstschema)
-            
+
             if self.args.sql:
                 dd.print_patch()
             else: