def test_parse_command_line_args_table_and_file(): """Test parsing invalid command line argugments.""" args = ['-t', 'table_1', '-f', 'my_file'] with pytest.raises(ValueError): parse_input.parse_command_line_args(args)
def test_parse_command_line_args_no_table(): """Test parsing invalid command line argugments.""" args = ['-s', 'schema_1'] with pytest.raises(ValueError): parse_input.parse_command_line_args(args)
def test_parse_command_line_args_table_file(): """Test parsing command line input input_file.""" args = ['-f', 'my_file'] parsed_args = parse_input.parse_command_line_args(args) assert 'my_file' == parsed_args.input_file
def test_parse_command_line_args_table_schema(): """Test parsing command line inputs table and schema.""" args = ['-s', 'schema_1', '-t', 'table_1'] parsed_args = parse_input.parse_command_line_args(args) assert 'schema_1' == parsed_args.schema assert 'table_1' == parsed_args.table
VALUES ( %(data_table_id)s, %(file_table_name)s ) """, { 'data_table_id': new_id, 'file_table_name': full_table_name }) return new_id if __name__ == "__main__": args = parse_input.parse_command_line_args(sys.argv[1:]) full_table_name = parse_input.derive_full_table_name(args) categorical_threshold = args.categorical input_file = args.input_file type_overrides = {} if input_file is not None: file_parser = parse_input.ParseInput() file_parser.parse(input_file) type_overrides = file_parser.type_overrides categ_threshold_config = file_parser.categorical_threshold date_format_dict = file_parser.date_format gmeta_output = file_parser.gmeta_output new_id = update_data_table(full_table_name)