in utilities/Hive_metastore_migration/src/hive_metastore_migration.py [0:0]
def get_start_id_for_id_name(self, hms):
hms.extract_metastore()
info_tuples = {
('ms_dbs', 'DB_ID'),
('ms_tbls', 'TBL_ID'),
('ms_sds', 'SD_ID'),
('ms_sds', 'CD_ID'),
('ms_sds', 'SERDE_ID'),
('ms_partitions', 'PART_ID'),
('ms_skewed_col_value_loc_map', 'STRING_LIST_ID_KID')
}
for table_name, id_name in info_tuples:
hms_df = eval('hms.' + table_name)
if hms_df and hms_df.count() > 0:
max_id = hms_df.select(id_name).rdd.max()[0] + 1
else:
max_id = 0
self.start_id_map[id_name] = max_id