in utilities/Hive_metastore_migration/src/hive_metastore_migration.py [0:0]
def parse_arguments(args):
parser = argparse.ArgumentParser(prog=args[0])
parser.add_argument('-m', '--mode', required=True, choices=[FROM_METASTORE, TO_METASTORE], help='Choose to migrate metastore either from JDBC or from S3')
parser.add_argument('-U', '--jdbc-url', required=True, help='Hive metastore JDBC url, example: jdbc:mysql://metastore.abcd.us-east-1.rds.amazonaws.com:3306')
parser.add_argument('-u', '--jdbc-username', required=True, help='Hive metastore JDBC user name')
parser.add_argument('-p', '--jdbc-password', required=True, help='Hive metastore JDBC password')
parser.add_argument('-d', '--database-prefix', required=False, help='Optional prefix for database names in Glue DataCatalog')
parser.add_argument('-t', '--table-prefix', required=False, help='Optional prefix for table name in Glue DataCatalog')
parser.add_argument('-o', '--output-path', required=False, help='Output path, either local directory or S3 path')
parser.add_argument('-i', '--input_path', required=False, help='Input path, either local directory or S3 path')
options = get_options(parser, args)
if options['mode'] == FROM_METASTORE:
validate_options_in_mode(
options=options, mode=FROM_METASTORE,
required_options=['output_path'],
not_allowed_options=['input_path']
)
elif options['mode'] == TO_METASTORE:
validate_options_in_mode(
options=options, mode=TO_METASTORE,
required_options=['input_path'],
not_allowed_options=['output_path']
)
else:
raise AssertionError('unknown mode ' + options['mode'])
return options