示例#1
0
def empty_db(connector, clean_box):
    # delete from tools_chromosome, tools_eachobservation, tools_uploadmd5
    operator = mc.Operator(connector)

    for t in clean_box:
        operator.clean_table(t)
    operator.terminate()
示例#2
0
def cleandb_except(connector, exception_box, exceptions):
    # delete from table where exceptions won't be deleted.
    operator = mc.Operator(connector)
    for t in exception_box:
        if exceptions != '':
            operator.clean_table(t, {'md5': ['!=', exceptions]})
        else:
            operator.clean_table(t)
        print('Exception drop Success in ', t)
    operator.terminate()
示例#3
0
def cleanup_once(login_file_name, logfile):
    connector = mc.Connector(login_file_name)
    operator = mc.Operator(connector)
    timenow = datetime.datetime.now()
    md5s = operator.autoclean(timenow)
    with open(logfile, 'a') as f:
        f.write("{}: Performing routine cleanup work --------".format(timenow))
        f.write('\n')
    for i in md5s:
        path = '/home/circ/circDraw/cirDraw/media/md5_data/' + str(i)
        delete_file_outputlog(path, logfile)
示例#4
0
def drop_db(connector):
    try:
        # drop table tools_chromosome, tools_eachobservation, tools_uploadmd5
        operator = mc.Operator(connector)
        drop_box = [
            'tools_chromosome', 'tools_eachobservation', 'tools_uploadmd5'
        ]
        for t in drop_box:
            operator.drop_table(t)
        operator.terminate()
        return True
    except Exception as e:
        print("Failed: drop_db in resetdb.py failed...")
        print("Error: ", e)
        return False
示例#5
0
def delete_row(connector):
    try:
        # delete some lines from table
        operator = mc.Operator(connector)
        table_name = 'django_migrations'
        conditions = {'app': 'tools'}
        # table_name = 'tools_uploadmd5'
        # conditions = {'MD5': 'dcf1208e1926aab1af379cedec7f254c'}

        operator.clean_table(table_name, conditions)
        operator.terminate()
        return True
    except Exception as e:
        print("Failed: delete_row in resetdb.py failed...")
        print("Error: ", e)
        return False