def update_table_stats(self, tablename, nr_rows, identity=Identity.get_identity(), now=time.time(), sum=False):

        # Keep track of how many updates a table has received.

        if tablename not in self.tables:
            self.tables[tablename] = { "updates" : 1, 
                                       "nr_rows" : nr_rows,
                                       "last_update_epoch" : now }
        else:
            if sum:
                self.tables[tablename]["nr_rows"] += nr_rows

            self.tables[tablename]["updates"] += 1
            self.tables[tablename]["last_update_epoch"] = now


        # Keep track of which "identities" have added to a table.

        if identity not in self.connections:

            self.connections[identity] = { 'tables' : { tablename : nr_rows }, 
                                           'last_update_epoch' : now }
        else:
            self.connections[identity]["last_update_epoch"] = now

            if sum and tablename in self.connections[identity]["tables"]:
                self.connections[identity]["tables"][tablename] += nr_rows
            else:
                self.connections[identity]["tables"][tablename] = nr_rows
dataset/ETHPy150Open MediaMath/qasino/lib/sqlite_backend.py/SqlConnections.update_table_stats/original