def list_existing_tables(project_id, dataset_id): existing_tables = [] all_table_objs = bq_utils.list_tables(project_id=project_id, dataset_id=dataset_id) for table_obj in all_table_objs: table_id = bq_utils.get_table_id_from_obj(table_obj) existing_tables.append(table_id) return existing_tables
def get_mapping_table_ids(project_id, combined_dataset_id): """ returns all the mapping table ids found in the dataset :param project_id: project_id containing the dataset :param combined_dataset_id: dataset_id containing mapping tables :return: returns mapping table ids """ table_objs = bq_utils.list_tables(combined_dataset_id, project_id=project_id) mapping_table_ids = [] for table_obj in table_objs: table_id = bq_utils.get_table_id_from_obj(table_obj) if MAPPING_PREFIX in table_id: mapping_table_ids.append(table_id) return mapping_table_ids