def clean_columns_name()

in flatten_join_nested_file.py [0:0]


def clean_columns_name(tbl_name, tables_info_map):

    global table_count
    global dataframes_map
    global dynamicframes_map

    table_count = table_count+1

    for col_name in tables_info_map[tbl_name]['columns']:

        # Clean column name and rename the dataframe attribute
        new_col_name = clean_name(
            'column', tbl_name, col_name, tables_info_map.keys(), '')
        dataframes_map[tbl_name] = dataframes_map[tbl_name].withColumnRenamed(
            col_name, new_col_name).drop('rownum')

        # if the column is a foreign key and we have configured the job to run the denormalization we will add the child table to the list of tables to join
        if is_foreign_key(new_col_name, tbl_name):

            child_tbl_name = store_join_metadata(
                'column', tbl_name, new_col_name)

            clean_columns_name(child_tbl_name, tables_info_map)

    store_join_metadata('table', tbl_name, '')

    # convert to Dynamicframes in preparation for write to repository
    dynamicframes_map[tbl_name] = DynamicFrame.fromDF(
        dataframes_map[tbl_name], glueContext, "dynamicframes_map[tbl_name]")