コード例 #1
0
ファイル: analyzedb_mgmt_utils.py プロジェクト: hellomokey/gp
def table_found_in_report_file(dbname, qualified_table):
    report_file = get_latest_analyze_report_file(dbname)
    for line in get_lines_from_file(report_file):
        if qualified_table == line:
            return True, report_file

    return False, report_file
コード例 #2
0
ファイル: analyzedb_mgmt_utils.py プロジェクト: hellomokey/gp
def get_mod_count_in_state_file(dbname, schema, table):
    file = get_latest_aostate_file(dbname)
    comma_name = ','.join([schema, table])
    for line in get_lines_from_file(file):
        if comma_name in line:
            return line.split(',')[2]
    return -1
コード例 #3
0
ファイル: analyzedb_mgmt_utils.py プロジェクト: 50wu/gpdb
def delete_table_from_state_files(dbname, qualified_table):
    comma_name = ','.join(qualified_table.split('.'))
    files = get_latest_analyze_state_files(dbname)
    for filename in files:
        lines = get_lines_from_file(filename)
        f = open(filename,"w")
        for line in lines:
            if not comma_name in line:
                f.write(line)
        f.close()
コード例 #4
0
ファイル: analyzedb_mgmt_utils.py プロジェクト: hellomokey/gp
def delete_table_from_state_files(dbname, qualified_table):
    comma_name = ','.join(qualified_table.split('.'))
    files = get_latest_analyze_state_files(dbname)
    for filename in files:
        lines = get_lines_from_file(filename)
        f = open(filename, "w")
        for line in lines:
            if comma_name not in line:
                f.write(line)
        f.close()
コード例 #5
0
ファイル: analyzedb_mgmt_utils.py プロジェクト: 50wu/gpdb
def table_found_in_state_file(dbname, qualified_table):
    comma_name = ','.join(qualified_table.split('.'))
    files = get_latest_analyze_state_files(dbname)
    if len(files) == 0:
        return False,""
    state_file = ""
    for state_file in files:
        found = False
        for line in get_lines_from_file(state_file):
            if comma_name in line:
                found = True
                continue
        if not found:
            return False,state_file
    return True,state_file
コード例 #6
0
ファイル: analyzedb_mgmt_utils.py プロジェクト: hellomokey/gp
def table_found_in_state_file(dbname, qualified_table):
    comma_name = ','.join(qualified_table.split('.'))
    files = get_latest_analyze_state_files(dbname)
    if len(files) == 0:
        return False, ""
    state_file = ""
    for state_file in files:
        found = False
        for line in get_lines_from_file(state_file):
            if comma_name in line:
                found = True
                continue
        if not found:
            return False, state_file
    return True, state_file
コード例 #7
0
ファイル: analyzedb_mgmt_utils.py プロジェクト: 50wu/gpdb
def column_found_in_state_file(dbname, qualified_table, col_name_list):
    comma_name = ','.join(qualified_table.split('.'))
    files = get_latest_analyze_state_files(dbname)
    if len(files) == 0:
        return False,"",""

    for state_file in files:
        if not "col_state_file" in state_file:
            continue
        for line in get_lines_from_file(state_file):
            if comma_name in line:
                for column in col_name_list.split(','):
                    if not column in line.split(',')[2:]:
                        return False,column,state_file
                return True,"",state_file
        return False,col_name_list,state_file
コード例 #8
0
ファイル: analyzedb_mgmt_utils.py プロジェクト: hellomokey/gp
def column_found_in_state_file(dbname, qualified_table, col_name_list):
    comma_name = ','.join(qualified_table.split('.'))
    files = get_latest_analyze_state_files(dbname)
    if len(files) == 0:
        return False, "", ""

    for state_file in files:
        if "col_state_file" not in state_file:
            continue
        for line in get_lines_from_file(state_file):
            if comma_name in line:
                for column in col_name_list.split(','):
                    if column not in line.split(',')[2:]:
                        return False, column, state_file
                return True, "", state_file
        return False, col_name_list, state_file