# Load and export data

Data exchange has two parts: a format describes the bytes, and a table schema describes their SQL values. Create explicit target columns before importing rows.

## Choose a direction

Formats can support input, output or both. Inspect their registered directions before choosing one:

```sql
SELECT name, is_input, is_output
FROM system.formats
WHERE name IN ('csv', 'json_each_row', 'parquet', 'yaml')
ORDER BY name
FORMAT csv;
```

```text
"csv",1,1
"json_each_row",1,1
"parquet",1,1
"yaml",1,1
```

Names use snake_case and ignore ASCII case. CamelCase names are not aliases.

## Load rows

Native stdin, native FROM INFILE and HTTP attached input send data to INSERT FORMAT. FROM INFILE reads the client's files. `file()` instead reads confined regular files under the server's `user_files_path` and can be used in SELECT or INSERT SELECT.

Most file sources require an explicit column/type list. Only `form` and `parquet_metadata` can supply their own column metadata.

## Export rows

Use SELECT FORMAT to choose a result encoding. Native `--query` writes exact bytes to stdout, including binary containers. Redirect binary output to a file rather than treating it as a terminal table.

## Guides

* [CSV and TSV](https://coordinatordb.com/docs/guides/clickhouse/data-formats/csv-tsv)
* [JSON](https://coordinatordb.com/docs/guides/clickhouse/data-formats/json/intro)
* [Binary files](https://coordinatordb.com/docs/guides/clickhouse/data-formats/binary)
* [Arrow and Avro](https://coordinatordb.com/docs/guides/clickhouse/data-formats/arrow-avro-orc)
* [Parquet](https://coordinatordb.com/docs/guides/clickhouse/data-formats/parquet)
* [SQL row exchange](https://coordinatordb.com/docs/guides/clickhouse/data-formats/sql)
* [Templates and regular expressions](https://coordinatordb.com/docs/guides/clickhouse/data-formats/templates-regex)

The [format reference](https://coordinatordb.com/docs/reference/formats) defines layouts, settings and type mappings.
