code: def delete_garbage(self):
          
          self.connection.query(
              "DELETE FROM `{db}`.`{tab}` WHERE ".format(tab=self.table_name, db=self.database) +
              " AND ".join(
                  'hash NOT IN (SELECT {column_name} FROM {referencing_table})'.format(**ref)
                  for ref in self.references) or "TRUE")
          print('Deleted %d items' % self.connection.query("SELECT ROW_COUNT()").fetchone()[0])
docs: Delete items that are no longer referenced.
          This operation is safe to perform at any time.