ClickHouse/docs/en/sql-reference/functions/files.md

31 lines
938 B
Markdown
Raw Normal View History

---
2022-08-28 14:53:34 +00:00
slug: /en/sql-reference/functions/files
2023-04-19 17:05:55 +00:00
sidebar_position: 75
sidebar_label: Files
---
2022-06-02 10:55:18 +00:00
## file
2023-06-01 18:27:34 +00:00
Reads a file as string and loads the data into the specified column. The file content is not interpreted.
2023-04-20 10:18:46 +00:00
Also see table function [file](../table-functions/file.md).
**Syntax**
``` sql
2022-07-14 09:49:30 +00:00
file(path[, default])
```
**Arguments**
2024-09-22 15:02:46 +00:00
- `path` — The path of the file relative to [user_files_path](../../operations/server-configuration-parameters/settings.md#user_files_path). Supports wildcards `*`, `**`, `?`, `{abc,def}` and `{N..M}` where `N`, `M` are numbers and `'abc', 'def'` are strings.
- `default` — The value returned if the file does not exist or cannot be accessed. Supported data types: [String](../data-types/string.md) and [NULL](../../sql-reference/syntax.md#null-literal).
**Example**
Inserting data from files a.txt and b.txt into a table as strings:
``` sql
2021-03-28 18:26:51 +00:00
INSERT INTO table SELECT file('a.txt'), file('b.txt');
```