Pretty 형식
Pretty 형식
Pretty 형식은 데이터를 유니코드 아트 표로 출력하며, 터미널에 색상을 표시하기 위해 ANSI 이스케이프 시퀀스를 사용해요. 표의 전체 그리드가 그려지고 각 행은 터미널에서 두 줄을 차지합니다. 각 결과 블록은 별도의 표로 출력되며, NULL은 ᴺᵁᴸᴸ로 표시돼요.
출처: 문서
본문
| Input | Output | Alias |
|---|---|---|
| ✗ | ✔ |
설명 (Description)
Pretty 형식은 데이터를 유니코드 아트 표로 출력하며, 터미널에 색상을 표시하기 위해 ANSI 이스케이프 시퀀스를 사용합니다. 표의 전체 그리드가 그려지고 각 행은 터미널에서 두 줄을 차지합니다. 각 결과 블록은 별도의 표로 출력됩니다. 이는 결과를 버퍼링하지 않고 블록을 출력하기 위해 필요합니다(버퍼링은 모든 값의 표시 너비를 미리 계산하기 위해 필요할 것입니다). NULL은 ᴺᵁᴸᴸ로 출력됩니다.
사용 예시 (Example usage)
예시(PrettyCompact 형식 기준):
Query``` SELECT * FROM t_null
Response```
┌─x─┬────y─┐
│ 1 │ ᴺᵁᴸᴸ │
└───┴──────┘
모든 Pretty 형식에서 행은 이스케이프되지 않습니다. 다음 예시는 PrettyCompact 형식 기준입니다:
Query``` SELECT 'String with 'quotes' and \t character' AS Escaping_test
Response```
┌─Escaping_test────────────────────────┐
│ String with 'quotes' and character │
└──────────────────────────────────────┘
터미널에 너무 많은 데이터를 덤프하는 것을 피하기 위해 처음 10,000개 행만 출력합니다. 행 수가 10,000개 이상이면 "Showed first 10 000" 메시지가 출력됩니다. 이 형식은 쿼리 결과 출력에만 적합하며 데이터 파싱에는 사용할 수 없습니다.
Pretty 형식은 총계 값(WITH TOTALS 사용 시)과 극단값(‘extremes’가 1로 설정된 경우) 출력을 지원합니다. 이 경우 총계 값과 극단값은 메인 데이터 뒤에 별도의 표로 출력됩니다. 다음 예시는 PrettyCompact 형식을 사용한 것입니다:
Query``` SELECT EventDate, count() AS c FROM test.hits GROUP BY EventDate WITH TOTALS ORDER BY EventDate FORMAT PrettyCompact
Response```
┌──EventDate─┬───────c─┐
│ 2014-03-17 │ 1406958 │
│ 2014-03-18 │ 1383658 │
│ 2014-03-19 │ 1405797 │
│ 2014-03-20 │ 1353623 │
│ 2014-03-21 │ 1245779 │
│ 2014-03-22 │ 1031592 │
│ 2014-03-23 │ 1046491 │
└────────────┴─────────┘
Totals:
┌──EventDate─┬───────c─┐
│ 1970-01-01 │ 8873898 │
└────────────┴─────────┘
Extremes:
┌──EventDate─┬───────c─┐
│ 2014-03-17 │ 1031592 │
│ 2014-03-23 │ 1406958 │
└────────────┴─────────┘
형식 설정 (Format settings)
다음 설정은 모든 Pretty 형식에 공통입니다:
| Setting | Description | Default |
|---|---|---|
| output_format_pretty_max_rows | Row limit for Pretty formats. | 10000 |
| output_format_pretty_max_column_pad_width | Maximum width to pad all values in a column in Pretty formats. | 250 |
| output_format_pretty_max_value_width | Maximum width of value to display in Pretty formats. If greater - it will be cut. | 10000 |
| output_format_pretty_color | Use ANSI escape sequences to paint colors in Pretty formats. | true |
| output_format_pretty_grid_charset | Charset for printing grid borders. Available charsets: ASCII, UTF-8. | UTF-8 |
| output_format_pretty_row_numbers | Add row numbers before each row for pretty output format. | true |
| output_format_pretty_display_footer_column_names | Display column names in the footer if table contains many rows. | true |
| output_format_pretty_display_footer_column_names_min_rows | Sets the minimum number of rows for which a footer will be displayed if output_format_pretty_display_footer_column_names is enabled. | 50 |