def drop_run(project_name, run_name):
    """
    Deletes a run from a desired project. If this causes the run_table to be empty then the entire project gets deleted
    :param project_name: String, project which contains the desire run_name
    :param run_name: String, run to delete
    """
    conn, c = open_data_base_connection()
    # delete all the variable tables first
    c.execute("SELECT variable_name FROM {}".format(run_name))
    try:
        all_variables = np.array(c.fetchall()).squeeze(axis=1)
        for i in all_variables:
            variable_table_name = run_name + '_' + i
            c.execute("""DROP TABLE IF EXISTS {}""".format(variable_table_name))
    except np.core._internal.AxisError:
        print("Did not find any values, so deleting run table directly.")

    c.execute("""DROP TABLE IF EXISTS {}""".format(run_name))
    c.execute("""DELETE FROM {} WHERE run_name='{}'""".format(project_name + '_run_table', run_name))

    # delete project if project_name+'_run_table' is empty
    c.execute("""SELECT run_name FROM {}""".format(project_name + '_run_table'))
    all_runs = c.fetchall()
    if len(all_runs) == 0:
        c.execute("""DROP TABLE IF EXISTS {}""".format(project_name + '_run_table'))
        c.execute("""DELETE FROM main_table WHERE project_name='{}'""".format(project_name))

    conn.commit()
    print("{} table deleted".format(run_name))
def drop_run ( project_name , run_name ) : conn , c = open_data_base_connection ( ) c . execute ( "SELECT variable_name FROM {}" . format ( run_name ) ) try : all_variables = np . array ( c . fetchall ( ) ) . squeeze ( axis = 1 ) for i in all_variables : variable_table_name = run_name + '_' + i c . execute ( """DROP TABLE IF EXISTS {}""" . format ( variable_table_name ) ) except np . core . _internal . AxisError : print ( "Did not find any values, so deleting run table directly." ) c . execute ( """DROP TABLE IF EXISTS {}""" . format ( run_name ) ) c . execute ( """DELETE FROM {} WHERE run_name='{}'""" . format ( project_name + '_run_table' , run_name ) ) c . execute ( """SELECT run_name FROM {}""" . format ( project_name + '_run_table' ) ) all_runs = c . fetchall ( ) if len ( all_runs ) == 0 : c . execute ( """DROP TABLE IF EXISTS {}""" . format ( project_name + '_run_table' ) ) c . execute ( """DELETE FROM main_table WHERE project_name='{}'""" . format ( project_name ) ) conn . commit ( ) print ( "{} table deleted" . format ( run_name ) )
Deletes a run from a desired project. If this causes the run_table to be empty then the entire project gets deleted
    :param project_name: String, project which contains the desire run_name
    :param run_name: String, run to delete