コード例 #1
0
ファイル: achilles.py プロジェクト: dcampbell-vumc/curation
def run_analyses(hpo_id):
    """
    Run the achilles analyses
    :param hpo_id: hpo_id of the site to run on
    :return: None
    """
    commands = _get_run_analysis_commands(hpo_id)
    for command in commands:
        if sql_wrangle.is_truncate(command) or sql_wrangle.is_drop(command):
            drop_or_truncate_table(command)
        else:
            run_analysis_job(command)
コード例 #2
0
def drop_or_truncate_table(command):
    """
    Deletes or truncates table
    :param command: query to run
    :return: None
    """
    if sql_wrangle.is_truncate(command):
        table_id = sql_wrangle.get_truncate_table_name(command)
        query = 'DELETE FROM %s WHERE TRUE' % table_id
        bq_utils.query(query)
    else:
        table_id = sql_wrangle.get_drop_table_name(command)
        bq_utils.delete_table(table_id)
コード例 #3
0
def run_heel(hpo_id):
    """
    Run heel commands

    :param hpo_id:  string name for the hpo identifier
    :returns: None
    """
    commands = _get_heel_commands(hpo_id)
    for command in commands:
        if sql_wrangle.is_truncate(command) or sql_wrangle.is_drop(command):
            drop_or_truncate_table(command)
        else:
            run_heel_analysis_job(command)
コード例 #4
0
ファイル: achilles.py プロジェクト: dcampbell-vumc/curation
def drop_or_truncate_table(command):
    """
    Deletes or truncates table
    Previously, deletion was used for both truncate and drop, and this function retains the behavior
    :param command: query to run
    :return: None
    """
    if sql_wrangle.is_truncate(command):
        table_id = sql_wrangle.get_truncate_table_name(command)
    else:
        table_id = sql_wrangle.get_drop_table_name(command)
    if bq_utils.table_exists(table_id):
        bq_utils.delete_table(table_id)