Skip to main content
Skip to main content

CSVWithNames

InputOutputAlias

Description

Also prints the header row with column names, similar to TabSeparatedWithNames.

Example Usage

Inserting Data

tip

Starting from version 23.1, ClickHouse will automatically detect headers in CSV files when using the CSV format, so it is not necessary to use CSVWithNames or CSVWithNamesAndTypes.

Using the following CSV file, named as football.csv:

Create a table:

Insert data using the CSVWithNames format:

Reading Data

Read data using the CSVWithNames format:

The output will be a CSV with a single header row:

Format Settings

note

If setting input_format_with_names_use_header is set to 1, the columns from input data will be mapped to the columns from the table by their names, columns with unknown names will be skipped if setting input_format_skip_unknown_fields is set to 1. Otherwise, the first row will be skipped.