in flatten_join_nested_file.py [0:0]
def store_join_metadata(obj_typ, tbl_name, new_col_name):
global tables_info_map
global tables_to_join_map
global number_nested_levels
if obj_typ == 'table':
tables_to_join_map[str(tables_info_map[tbl_name]['nested_lvl'])
][tbl_name]['join_to_tbls'] = tables_info_map[tbl_name]['join_to_tbls']
tables_to_join_map[str(tables_info_map[tbl_name]['nested_lvl'])
][tbl_name]['join_col'] = tables_info_map[tbl_name]['join_col']
tables_to_join_map[str(tables_info_map[tbl_name]['nested_lvl'])
][tbl_name]['has_child'] = tables_info_map[tbl_name]['has_child']
if obj_typ == 'column':
# set the number_nested_levels for this table
table_nested_level = tables_info_map[tbl_name]['nested_lvl']
# get the child table name and join level
child_tbl_name = get_child_tbl_name(new_col_name)
child_tbl_join_lvl = table_nested_level + 1
number_nested_levels = max(
number_nested_levels, child_tbl_join_lvl)
# add the child table to the list of tables to join to for the current teable, and the foreign keys
tables_info_map[tbl_name]['join_to_tbls'].append(child_tbl_name)
tables_info_map[tbl_name]['join_col'].append(new_col_name)
tables_info_map[tbl_name]['has_child'] = True
tables_info_map[child_tbl_name]['nested_lvl'] = child_tbl_join_lvl
# add the child table to the next level in the tables_to_join_map dictionary
if len(tables_to_join_map) == child_tbl_join_lvl:
tables_to_join_map[str(child_tbl_join_lvl)] = {}
tables_to_join_map[str(child_tbl_join_lvl)][child_tbl_name] = {
'join_to_tbls': [], 'join_col': [], 'has_child': False}
return child_tbl_name