> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> CustomSeparated 포맷 문서

# CustomSeparated

| 입력 | 출력 | 별칭 |
| -- | -- | -- |
| ✔  | ✔  |    |

<div id="description">
  ## 설명
</div>

[Template](/docs/ko/reference/formats/Template/Template)와 유사하지만, 모든 컬럼의 이름과 타입을 출력하거나 읽으며, [format\_custom\_escaping\_rule](/docs/ko/reference/settings/formats#format_custom_escaping_rule) 설정의 이스케이프 규칙과 다음 설정의 구분자를 사용합니다.

* [format\_custom\_field\_delimiter](/docs/ko/reference/settings/formats#format_custom_field_delimiter)
* [format\_custom\_row\_before\_delimiter](/docs/ko/reference/settings/formats#format_custom_row_before_delimiter)
* [format\_custom\_row\_after\_delimiter](/docs/ko/reference/settings/formats#format_custom_row_after_delimiter)
* [format\_custom\_row\_between\_delimiter](/docs/ko/reference/settings/formats#format_custom_row_between_delimiter)
* [format\_custom\_result\_before\_delimiter](/docs/ko/reference/settings/formats#format_custom_result_before_delimiter)
* [format\_custom\_result\_after\_delimiter](/docs/ko/reference/settings/formats#format_custom_result_after_delimiter)

<Note>
  포맷 문자열에 정의된 이스케이프 규칙 설정과 구분자는 사용하지 않습니다.
</Note>

[TemplateIgnoreSpaces](/docs/ko/reference/formats/Template/TemplateIgnoreSpaces)와 유사한 [`CustomSeparatedIgnoreSpaces`](/docs/ko/reference/formats/CustomSeparated/CustomSeparatedIgnoreSpaces) 포맷도 있습니다.

<div id="example-usage">
  ## 예시 사용
</div>

<div id="inserting-data">
  ### 데이터 삽입
</div>

`football.txt`라는 이름의 다음 txt 파일을 사용합니다:

```text theme={null}
row('2022-04-30';2021;'Sutton United';'Bradford City';1;4),row('2022-04-30';2021;'Swindon Town';'Barrow';2;1),row('2022-04-30';2021;'Tranmere Rovers';'Oldham Athletic';2;0),row('2022-05-02';2021;'Salford City';'Mansfield Town';2;2),row('2022-05-02';2021;'Port Vale';'Newport County';1;2),row('2022-05-07';2021;'Barrow';'Northampton Town';1;3),row('2022-05-07';2021;'Bradford City';'Carlisle United';2;0),row('2022-05-07';2021;'Bristol Rovers';'Scunthorpe United';7;0),row('2022-05-07';2021;'Exeter City';'Port Vale';0;1),row('2022-05-07';2021;'Harrogate Town A.F.C.';'Sutton United';0;2),row('2022-05-07';2021;'Hartlepool United';'Colchester United';0;2),row('2022-05-07';2021;'Leyton Orient';'Tranmere Rovers';0;1),row('2022-05-07';2021;'Mansfield Town';'Forest Green Rovers';2;2),row('2022-05-07';2021;'Newport County';'Rochdale';0;2),row('2022-05-07';2021;'Oldham Athletic';'Crawley Town';3;3),row('2022-05-07';2021;'Stevenage Borough';'Salford City';4;2),row('2022-05-07';2021;'Walsall';'Swindon Town';0;3)
```

사용자 지정 구분자 설정:

```sql theme={null}
SET format_custom_row_before_delimiter = 'row(';
SET format_custom_row_after_delimiter = ')';
SET format_custom_field_delimiter = ';';
SET format_custom_row_between_delimiter = ',';
SET format_custom_escaping_rule = 'Quoted';
```

데이터를 삽입합니다:

```sql theme={null}
INSERT INTO football FROM INFILE 'football.txt' FORMAT CustomSeparated;
```

<div id="reading-data">
  ### 데이터 읽기
</div>

사용자 지정 구분자 설정을 구성하세요:

```sql theme={null}
SET format_custom_row_before_delimiter = 'row(';
SET format_custom_row_after_delimiter = ')';
SET format_custom_field_delimiter = ';';
SET format_custom_row_between_delimiter = ',';
SET format_custom_escaping_rule = 'Quoted';
```

`CustomSeparated` 포맷으로 데이터를 읽습니다:

```sql theme={null}
SELECT *
FROM football
FORMAT CustomSeparated
```

출력은 설정된 사용자 지정 포맷으로 제공됩니다:

```text theme={null}
row('2022-04-30';2021;'Sutton United';'Bradford City';1;4),row('2022-04-30';2021;'Swindon Town';'Barrow';2;1),row('2022-04-30';2021;'Tranmere Rovers';'Oldham Athletic';2;0),row('2022-05-02';2021;'Port Vale';'Newport County';1;2),row('2022-05-02';2021;'Salford City';'Mansfield Town';2;2),row('2022-05-07';2021;'Barrow';'Northampton Town';1;3),row('2022-05-07';2021;'Bradford City';'Carlisle United';2;0),row('2022-05-07';2021;'Bristol Rovers';'Scunthorpe United';7;0),row('2022-05-07';2021;'Exeter City';'Port Vale';0;1),row('2022-05-07';2021;'Harrogate Town A.F.C.';'Sutton United';0;2),row('2022-05-07';2021;'Hartlepool United';'Colchester United';0;2),row('2022-05-07';2021;'Leyton Orient';'Tranmere Rovers';0;1),row('2022-05-07';2021;'Mansfield Town';'Forest Green Rovers';2;2),row('2022-05-07';2021;'Newport County';'Rochdale';0;2),row('2022-05-07';2021;'Oldham Athletic';'Crawley Town';3;3),row('2022-05-07';2021;'Stevenage Borough';'Salford City';4;2),row('2022-05-07';2021;'Walsall';'Swindon Town';0;3)
```

<div id="format-settings">
  ## 포맷 설정
</div>

추가 설정:

| 설정                                                                                                                                                 | 설명                                                                     | 기본값     |
| -------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ------- |
| [input\_format\_custom\_detect\_header](/docs/ko/reference/settings/formats#input_format_custom_detect_header)                                          | 이름과 타입이 포함된 헤더가 있으면 자동으로 감지하도록 합니다.                                    | `true`  |
| [input\_format\_custom\_skip\_trailing\_empty\_lines](/docs/ko/reference/settings/formats#input_format_custom_skip_trailing_empty_lines)                | 파일 끝에 있는 후행 빈 줄을 건너뜁니다.                                                | `false` |
| [input\_format\_custom\_allow\_variable\_number\_of\_columns](/docs/ko/reference/settings/formats#input_format_custom_allow_variable_number_of_columns) | CustomSeparated 포맷에서 가변 개수의 컬럼을 허용하고, 추가 컬럼은 무시하며 누락된 컬럼에는 기본값을 사용합니다. | `false` |
