# Establish Connection database = config['rethink_db'] db = RunbookDB(configfile) conn = db.connect() tables = [ "users", "reactions", "monitors", "dc1queue", "dc2queue", "events", "history", "subscription_history", ] for table in tables: print "==========TABLE %s" % table cursor = r.db(database).table(table).run(conn) for row in cursor: pprint.pprint(row, width=1) print "================================================================" print # Close Connection db.close() print 'DB Dump Complete!'
with open(configfile, 'r') as cfh: config = yaml.safe_load(cfh) # Open Config File and Parse Config Data db=RunbookDB(configfile) conn=db.connect() # Open External Connections # ------------------------------------------------------------------ # RethinkDB Server # Helper Functions # ------------------------------------------------------------------ # Execute # ------------------------------------------------------------------ @full_profile def purge_old_history(): chktime = time.time() - config['history_retention'] results = r.table('history').filter( (r.row['starttime'] < chktime)).delete().run(conn) purge_old_history() db.close()