Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

添加ClickHouse sql脚本 #13

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
TommyLemon merged 1 commit into APIJSON:master from qiujunlin:master
Sep 10, 2021
Merged

添加ClickHouse sql脚本 #13

TommyLemon merged 1 commit into APIJSON:master from qiujunlin:master
Sep 10, 2021

Conversation

Copy link
Contributor

@qiujunlin qiujunlin commented Sep 10, 2021

文件格式,和mysql的目录结构一样:

脚本在ClickHouse文件夹下,并包含single文件夹(存储每个表的sql脚本),外面一个sys.sql 存储总的脚本、

脚本由mysql中的数据转换而来。修改规则如下:

1.修改引擎为 MergeTree ,官方主推

2.CliskHouse String类型,字符串可以是任意长度的。它可以包含任意的字节集,包含空字节。ClickHouse字符串类型可以代替其他 DBMSs 中的VARCHAR、BLOB、CLOB 等类型

3.对关键字细节定义进行了修改。替换的内容为ClikHouse 不支持的定义方式,并替换为ClickHouse支持的格式。

replaceAll(" NOT NULL", "")
.replaceAll("AUTO_INCREMENT", "")
.replaceAll("CHARACTER SET utf8mb4", "")
 .replaceAll("CHARACTER SET utf8", "")
.replaceAll("ON UPDATE CURRENT_TIMESTAMP", "")
.replaceAll("CURRENT_TIMESTAMP", "")
.replaceAll("datetime DEFAULT NULL", " DateTime ")
.replaceAll(" datetime ", " DateTime ");
.replaceAll("varchar\\(\\d+\\) DEFAULT NULL", "Nullable(String)");
.replaceAll("varchar\\(\\d+\\)", "String");
.replaceAll("text", "String");
并对bigint tinyint 类型进行了替换.替换为 ClickHouse支持的 Int8/Int16/Int32/Int64

经过导入,并测试后,没有发现问题,符合官方文档的要求。
参考官方文档:https://clickhouse.tech/docs/en/getting-started/tutorial/

TommyLemon reacted with thumbs up emoji
@TommyLemon TommyLemon merged commit 817ea1e into APIJSON:master Sep 10, 2021
Copy link
Member

感谢贡献,赞~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /