pgtoolkit/pgdatadiff.py
changeset 14 a900bc629ecc
parent 12 203be9022b46
child 27 5fb4883604d6
equal deleted inserted replaced
13:16dc5dec9c36 14:a900bc629ecc
   184         
   184         
   185         Supports INSERT, DELETE and UPDATE operations.
   185         Supports INSERT, DELETE and UPDATE operations.
   186         
   186         
   187         '''
   187         '''
   188         for ln in self.iter_diff():
   188         for ln in self.iter_diff():
   189             print(ln.format_patch(self.fulltable2))
   189             print(ln.format_patch(self.fulltable1))
   190 
   190 
   191     def _select(self):
   191     def _select(self):
   192         browser = pgbrowser.PgBrowser(self.conn1)
   192         browser = pgbrowser.PgBrowser(self.conn1)
   193         columns = browser.list_columns(schema=self.schema1, table=self.table1, order=1)
   193         columns = browser.list_columns(schema=self.schema1, table=self.table1, order=1)
   194         columns_sel = ', '.join(['"' + x['name'] + '"' for x in columns])
   194         columns_sel = ', '.join(['"' + x['name'] + '"' for x in columns])
   219         return None
   219         return None
   220     
   220     
   221     def _compare_row(self, row1, row2):
   221     def _compare_row(self, row1, row2):
   222         if row2 is None:
   222         if row2 is None:
   223             cols1 = OrderedDict(zip(self.colnames, row1))
   223             cols1 = OrderedDict(zip(self.colnames, row1))
   224             return DiffData('-', cols1, None)
   224             id = (self.colnames[0], row1[0])
       
   225             return DiffData('-', cols1, None, id=id)
   225         if row1 is None:
   226         if row1 is None:
   226             cols2 = OrderedDict(zip(self.colnames, row2))
   227             cols2 = OrderedDict(zip(self.colnames, row2))
   227             return DiffData('+', None, cols2)
   228             return DiffData('+', None, cols2)
   228         
   229         
   229         if row1[0] < row2[0]:
   230         if row1[0] < row2[0]: