Skip to content

docs: format_name #13409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions docs/doc/13-sql-reference/50-file-format-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@
title: Input & Output File Formats
---

Databend accepts a variety of file formats both as a source and as a target for data loading or unloading. For example, you can load data into Databend from a file with the [COPY INTO table command](../14-sql-commands/10-dml/dml-copy-into-table.md) or the Streaming Load API. You can also unload data from Databend into a file with the [COPY INTO location command](../14-sql-commands/10-dml/dml-copy-into-location.md) command. To do so, you need to tell Databend what the file looks like using the following syntax:
Databend accepts a variety of file formats both as a source and as a target for data loading or unloading. For example, you can load data into Databend from a file with the [COPY INTO table command](../14-sql-commands/10-dml/dml-copy-into-table.md) or the Streaming Load API. You can also unload data from Databend into a file with the [COPY INTO location command](../14-sql-commands/10-dml/dml-copy-into-location.md) command.

## Syntax

To specify a file format in a statement, use the following syntax:

```sql
FILE_FORMAT = ( TYPE = { CSV | TSV | NDJSON | PARQUET | XML } [ formatTypeOptions ] )
```
-- Specify a standard file format
... FILE_FORMAT = ( TYPE = { CSV | TSV | NDJSON | PARQUET | XML } [ formatTypeOptions ] )

`Type`: Specifies the file format. Must be one of the ones listed above that Databend supports.
-- Specify a custom file format
... FILE_FORMAT = ( FORMAT_NAME = '<your-custom-format>' )
```

:::note
Databend currently supports XML as a source ONLY. Unloading data into an XML file is not supported yet.
:::
- Databend currently supports XML as a source ONLY. Unloading data into an XML file is not supported yet.
- If FILE_FORMAT is not explicitly specified, the default format used is PARQUET.

If `FILE_FORMAT` is not specified, use `FILE_FORMAT = (TYPE = PARQUET)` by default.
### formatTypeOptions

`formatTypeOptions`: Includes one or more options to describe other format details about the file. The options vary depending on the file format. See the sections below to find out the available options for each supported file format.
`formatTypeOptions` includes one or more options to describe other format details about the file. The options vary depending on the file format. See the sections below to find out the available options for each supported file format.

```sql
formatTypeOptions ::=
Expand Down
4 changes: 2 additions & 2 deletions docs/doc/14-sql-commands/10-dml/dml-copy-into-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,6 @@ CREATE TABLE t
#### Step 3: Load with custom file format.

```sql
COPY INTO t FROM @t_stage files=('data.csv')
FILE_FORMAT=(NAME='my_csv_format');
COPY INTO t FROM @t_stage FILES=('data.csv')
FILE_FORMAT=(FORMAT_NAME='my_csv_format');
```