This commit is contained in:
2021-11-14 14:32:08 +08:00
parent f75ad8bedd
commit b0f6120151
152 changed files with 22219 additions and 8 deletions

30
content/post/ch-file.md Normal file
View File

@@ -0,0 +1,30 @@
---
title: "ClickHouse 表引擎之 File"
date: 2020-10-08T12:00:00+08:00
lastmod: 2020-10-08T12:00:00+08:00
tags: []
categories: ["clickhouse"]
---
# File 表引擎简介
- 直接读取本地文件
- 修改文件 = 数据更新
- 导出数据到本地文件
- 数据格式转换
# 创建 FILE 引擎表
- 声明
```sql
ENGINE = File('format')
```
- format 是文件中的数据格式,如 TSV、CSV 和 JSONEachRow 等
- 数据文件保存在 config.xml 中指定的 path 下,目录名是表名,数据文件名是 data.{format}
- 可以通过 CREATE 语句建表,也可以直接在 shell 下创建目录文件,再通过 ATTACH 语句挂载
```sql
ATTACH TABLE file_table(
name String,
value UInt32
) ENGINE = file(CSV)
```