if __name__ == '__main__': from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser import cli_options parser = ArgumentParser( usage='usage: \n' ' %(prog)s [options] [populate]\n\n' ' Create and populate database(s). The Impala database will always be \n' ' included. Postgres is optional. The other databases are not supported.\n\n' ' %(prog)s [options] migrate\n\n' ' Migrate an Impala database to another database type. The destination \n' ' database will be dropped and recreated.', formatter_class=ArgumentDefaultsHelpFormatter) cli_options.add_logging_options(parser) cli_options.add_cluster_options(parser) cli_options.add_db_name_option(parser) cli_options.add_connection_option_groups(parser) group = parser.add_argument_group('Database Population Options') group.add_argument('--randomization-seed', default=1, type=int, help='The randomization will be initialized with this seed. Using the same seed ' 'will produce the same results across runs.') cli_options.add_storage_format_options(group) group.add_argument('--create-data-files', default=False, action='store_true', help='Create files that can be used to repopulate the databases elsewhere.') group.add_argument('--table-count', default=10, type=int, help='The number of tables to generate.') group.add_argument('--min-column-count', default=1, type=int, help='The minimum number of columns to generate per table.') group.add_argument('--max-column-count', default=100, type=int,
'they are known errors.\n' '%(query_timeout_count)s queries timed out and were excluded from all counts.') \ % summary_params if __name__ == '__main__': import sys from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser import cli_options from query_profile import PROFILES parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter) cli_options.add_logging_options(parser) cli_options.add_db_name_option(parser) cli_options.add_cluster_options(parser) cli_options.add_connection_option_groups(parser) cli_options.add_timeout_option(parser) parser.add_argument('--test-db-type', default=IMPALA, choices=(HIVE, IMPALA, MYSQL, ORACLE, POSTGRESQL), help='The type of the test database to use. Ex: IMPALA.') parser.add_argument('--ref-db-type', default=POSTGRESQL, choices=(MYSQL, ORACLE, POSTGRESQL), help='The type of the ref database to use. Ex: POSTGRESQL.') parser.add_argument('--stop-on-mismatch', default=False, action='store_true', help='Exit immediately upon find a discrepancy in a query result.') parser.add_argument('--stop-on-crash', default=False, action='store_true', help='Exit immediately if Impala crashes.') parser.add_argument('--query-count', default=1000000, type=int, help='Exit after running the given number of queries.')