populator.max_row_count = args.max_row_count populator.allowed_storage_formats = args.storage_file_formats.split( ',') if args.use_hive: with cluster.hive.connect() as conn: with conn.cursor() as cursor: cursor.ensure_empty_db(args.db_name) else: with cluster.impala.connect() as conn: with conn.cursor() as cursor: cursor.invalidate_metadata() cursor.ensure_empty_db(args.db_name) if args.use_postgresql: with cli_options.create_connection(args) as postgresql_conn: with postgresql_conn.cursor() as cursor: cursor.ensure_empty_db(args.db_name) postgresql_conn = cli_options.create_connection( args, db_name=args.db_name) else: postgresql_conn = None populator.populate_db(args.table_count, postgresql_conn=postgresql_conn) else: if args.migrate_table_names: table_names = args.migrate_table_names.split(',') else: table_names = None with cli_options.create_connection(args) as conn: with conn.cursor() as cursor:
for profile in PROFILES: profile_name = profile.__name__ if profile_name.endswith('Profile'): profile_name = profile_name[:-1 * len('Profile')] profiles[profile_name.lower()] = profile parser.add_argument('--profile', default='default', choices=(sorted(profiles.keys())), help='Determines the mix of SQL features to use during query generation.') # TODO: Seed the random query generator for repeatable queries? args = parser.parse_args() cli_options.configure_logging( args.log_level, debug_log_file=args.debug_log_file, log_thread_name=True) cluster = cli_options.create_cluster(args) ref_conn = cli_options.create_connection(args, args.ref_db_type, db_name=args.db_name) if args.test_db_type == IMPALA: test_conn = cluster.impala.connect(db_name=args.db_name) elif args.test_db_type == HIVE: test_conn = cluster.hive.connect(db_name=args.db_name) else: test_conn = cli_options.create_connection( args, args.test_db_type, db_name=args.db_name) # Create an instance of profile class (e.g. DefaultProfile) query_profile = profiles[args.profile]() if args.explain_only: searcher = FrontendExceptionSearcher(query_profile, ref_conn, test_conn) searcher.search(args.query_count) else: diff_searcher = QueryResultDiffSearcher(query_profile, ref_conn, test_conn) query_timeout_seconds = args.timeout
parser.add_argument( '--profile', default='default', choices=(sorted(profiles.keys())), help= 'Determines the mix of SQL features to use during query generation.') # TODO: Seed the random query generator for repeatable queries? args = parser.parse_args() cli_options.configure_logging(args.log_level, debug_log_file=args.debug_log_file, log_thread_name=True) cluster = cli_options.create_cluster(args) ref_conn = cli_options.create_connection(args, args.ref_db_type, db_name=args.db_name) if args.test_db_type == IMPALA: test_conn = cluster.impala.connect(db_name=args.db_name) elif args.test_db_type == HIVE: test_conn = cluster.hive.connect(db_name=args.db_name) else: test_conn = cli_options.create_connection(args, args.test_db_type, db_name=args.db_name) # Create an instance of profile class (e.g. DefaultProfile) query_profile = profiles[args.profile]() if args.explain_only: searcher = FrontendExceptionSearcher(query_profile, ref_conn, test_conn) searcher.search(args.query_count)
populator.min_row_count = args.min_row_count populator.max_row_count = args.max_row_count populator.allowed_storage_formats = args.storage_file_formats.split(',') if args.use_hive: with cluster.hive.connect() as conn: with conn.cursor() as cursor: cursor.ensure_empty_db(args.db_name) else: with cluster.impala.connect() as conn: with conn.cursor() as cursor: cursor.invalidate_metadata() cursor.ensure_empty_db(args.db_name) if args.use_postgresql: with cli_options.create_connection(args) as postgresql_conn: with postgresql_conn.cursor() as cursor: cursor.ensure_empty_db(args.db_name) postgresql_conn = cli_options.create_connection(args, db_name=args.db_name) else: postgresql_conn = None populator.populate_db(args.table_count, postgresql_conn=postgresql_conn) else: if args.migrate_table_names: table_names = args.migrate_table_names.split(',') else: table_names = None with cli_options.create_connection(args) as conn: with conn.cursor() as cursor: cursor.ensure_empty_db(args.db_name) with cli_options.create_connection(args, db_name=args.db_name) as conn: