ClickHouse/docs/en/sql-reference/functions/files.md
2023-04-19 17:05:55 +00:00

1.2 KiB

slug sidebar_position sidebar_label
/en/sql-reference/functions/files 75 Files

file

Reads file as a String. The file content is not parsed, so any information is read as one string and placed into the specified column.

Syntax

file(path[, default])

Arguments

  • path — The relative path to the file from user_files_path. Path to file support following wildcards: *, ?, {abc,def} and {N..M} where N, M — numbers, 'abc', 'def' — strings.
  • default — The value that will be returned in the case when a file does not exist or cannot be accessed. Data types supported: String and NULL.

Example

Inserting data from files a.txt and b.txt into a table as strings:

Query:

INSERT INTO table SELECT file('a.txt'), file('b.txt');

See Also