diff --git a/README.md b/README.md index 251d179dc..b04c3285a 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,7 @@ The core capabilities mainly consist of the following parts: ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white) ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) ![macOS](https://img.shields.io/badge/mac%20os-000000?style=for-the-badge&logo=macos&logoColor=F0F0F0) +![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white) [**Quickstart**](https://db-gpt.readthedocs.io/en/latest/getting_started/install/deploy/deploy.html) diff --git a/README.zh.md b/README.zh.md index ea91ac93d..954a26d34 100644 --- a/README.zh.md +++ b/README.zh.md @@ -158,6 +158,7 @@ DB-GPT基于 [FastChat](https://github.com/lm-sys/FastChat) 构建大模型运 ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white) ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) ![macOS](https://img.shields.io/badge/mac%20os-000000?style=for-the-badge&logo=macos&logoColor=F0F0F0) +![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white) [**快速开始 **](https://db-gpt.readthedocs.io/projects/db-gpt-docs-zh-cn/zh_CN/latest/getting_started/install/deploy/deploy.html) diff --git a/docs/getting_started/application/chatdb/chatdb.md b/docs/getting_started/application/chatdb/chatdb.md index 0344c9f8e..97cf22bba 100644 --- a/docs/getting_started/application/chatdb/chatdb.md +++ b/docs/getting_started/application/chatdb/chatdb.md @@ -27,6 +27,15 @@ you can execute sql script to generate data. ![db plugins demonstration](../../../../assets/chat_data/add_datasource.png) +```{note} +now DB-GPT support Datasource Type + +* Mysql +* Sqlite +* DuckDB +* Clickhouse +``` + ### 2.ChatData After successfully setting up the data source, you can start conversing with the database. You can ask it to generate @@ -34,6 +43,7 @@ SQL for you or inquire about relevant information on the database's metadata. ![db plugins demonstration](../../../../assets/chat_data/chatdata_eg.png) ### 3.ChatDB + ![db plugins demonstration](../../../../assets/chat_data/chatdb_eg.png) diff --git a/docs/getting_started/faq/chatdb/chatdb_faq.md b/docs/getting_started/faq/chatdb/chatdb_faq.md index 108db9ebf..19a0537dc 100644 --- a/docs/getting_started/faq/chatdb/chatdb_faq.md +++ b/docs/getting_started/faq/chatdb/chatdb_faq.md @@ -1,10 +1,24 @@ Chat DB FAQ ================================== -##### Q1: What difference between ChatData and ChatDB -ChatData generates SQL from natural language and executes it. ChatDB involves conversing with metadata from the Database, including metadata about databases, tables, and fields. -##### Q2: The suitable llm model currently supported for text-to-SQL is? +##### Q1: What difference between ChatData and ChatDB + +ChatData generates SQL from natural language and executes it. ChatDB involves conversing with metadata from the +Database, including metadata about databases, tables, and fields. + +##### Q2: The suitable llm model currently supported for text-to-SQL is? + Now vicunna-13b-1.5 and llama2-70b is more suitable for text-to-SQL. -##### Q3: How to fine-tune Text-to-SQL in DB-GPT +##### Q3: How to fine-tune Text-to-SQL in DB-GPT + there is another github project for Text-to-SQL fine-tune (https://github.com/eosphoros-ai/DB-GPT-Hub) + +##### Q4: chatdata with clickhouse clickhouse-sqlalchemy 0.2.4 requires sqlalchemy<1.5,>=1.4.24, but you have sqlalchemy 2.0.20 which is incompatible + +Just set sqlalchemy<1.5,>=1.4.24 + +```commandline +pip install clickhouse-driver +pip install sqlalchemy==1.4.24 +``` \ No newline at end of file diff --git a/docs/locales/zh_CN/LC_MESSAGES/getting_started/application/chatdb/chatdb.po b/docs/locales/zh_CN/LC_MESSAGES/getting_started/application/chatdb/chatdb.po index 940f6a422..8ba8706e9 100644 --- a/docs/locales/zh_CN/LC_MESSAGES/getting_started/application/chatdb/chatdb.po +++ b/docs/locales/zh_CN/LC_MESSAGES/getting_started/application/chatdb/chatdb.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: DB-GPT 👏👏 0.3.5\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-08-18 17:49+0800\n" +"POT-Creation-Date: 2023-08-22 13:28+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: zh_CN\n" @@ -20,12 +20,12 @@ msgstr "" "Generated-By: Babel 2.12.1\n" #: ../../getting_started/application/chatdb/chatdb.md:1 -#: 7bb2659a189b4d8ea9e24b4d7911759e +#: 45e6efede20d49d49f9e658bae7f4c08 msgid "ChatData & ChatDB" msgstr "ChatData & ChatDB" #: ../../getting_started/application/chatdb/chatdb.md:3 -#: 90784ed8f40c49e09fb91a0918b056cf +#: 777a279edbf4491095d24922ebe873a7 msgid "" "ChatData generates SQL from natural language and executes it. ChatDB " "involves conversing with metadata from the Database, including metadata " @@ -36,64 +36,66 @@ msgstr "" "plugins demonstration](../../../../assets/chat_data/chat_data.jpg)" #: ../../getting_started/application/chatdb/chatdb.md:3 -#: ../../getting_started/application/chatdb/chatdb.md:14 -#: ../../getting_started/application/chatdb/chatdb.md:16 -#: ../../getting_started/application/chatdb/chatdb.md:18 #: ../../getting_started/application/chatdb/chatdb.md:20 #: ../../getting_started/application/chatdb/chatdb.md:24 -#: 2af94cf92f7d4b7382aa9878a51a53f3 4858db05f4094aec93c0582546a7d76b +#: ../../getting_started/application/chatdb/chatdb.md:28 +#: ../../getting_started/application/chatdb/chatdb.md:40 +#: ../../getting_started/application/chatdb/chatdb.md:45 +#: 310dbee2849740f6946efa1a062bb87c 8e07c72f882341da8c342a657e88f162 +#: a016749ede034252b30557415226db56 c8513e01123443cbbb0e1afc26d46fff +#: dad795c828cf453ab6faf22497bc0465 msgid "db plugins demonstration" msgstr "db plugins demonstration" -#: ../../getting_started/application/chatdb/chatdb.md:4 -#: 96cec2f2107a4d99a9e94aed789e2344 +#: ../../getting_started/application/chatdb/chatdb.md:7 +#: 5c9db27b472f4edfab8e0a0d6ea0f958 msgid "1.Choose Datasource" msgstr "1.Choose Datasource" -#: ../../getting_started/application/chatdb/chatdb.md:5 -#: 25bd983e3b2f413c9cb2c04cc1631313 +#: ../../getting_started/application/chatdb/chatdb.md:9 +#: 1a503a45cb134430b6619812a27cf371 msgid "" "If you are using DB-GPT for the first time, you need to add a data source" " and set the relevant connection information for the data source." msgstr "如果你是第一次使用DB-GPT, 首先需要添加数据源,设置数据源的相关连接信息" -#: ../../getting_started/application/chatdb/chatdb.md:8 -#: 32c6bcabfdd14269b0ca04f2723c4745 +#: ../../getting_started/application/chatdb/chatdb.md:13 +#: 70a1af47305b4adebb7d10cc87c63b5c msgid "there are some example data in DB-GPT-NEW/DB-GPT/docker/examples" msgstr "在DB-GPT-NEW/DB-GPT/docker/examples有数据示例" -#: ../../getting_started/application/chatdb/chatdb.md:10 -#: f582ded883b34b208af7ba44dd1d7a87 +#: ../../getting_started/application/chatdb/chatdb.md:15 +#: d53369cf3c714865b2cacf5a8e203848 msgid "you can execute sql script to generate data." msgstr "你可以通过执行sql脚本生成测试数据" -#: ../../getting_started/application/chatdb/chatdb.md:13 -#: 77e5025ea41b4d2997172ef847cc94c0 +#: ../../getting_started/application/chatdb/chatdb.md:18 +#: c031dd7c1f704cd8b5cb868222cfa318 msgid "1.1 Datasource management" msgstr "1.1 Datasource management" -#: ../../getting_started/application/chatdb/chatdb.md:14 -#: 7a94c5d8f1d24cb28ecb933f63ea1bf0 +#: ../../getting_started/application/chatdb/chatdb.md:20 +#: 7125e6532f0549cf9886a2e4d7de90ce msgid "![db plugins demonstration](../../../../assets/chat_data/db_entry.png)" msgstr "![db plugins demonstration](../../../../assets/chat_data/db_entry.png)" -#: ../../getting_started/application/chatdb/chatdb.md:15 -#: ba5b3576317749d9bdcd6c4e2a7eee51 +#: ../../getting_started/application/chatdb/chatdb.md:22 +#: b8097bea350444378b331878aa863e0a msgid "1.2 Connection management" msgstr "1.2 Connection管理" -#: ../../getting_started/application/chatdb/chatdb.md:16 -#: 79114a69a61642c6970358629340263b +#: ../../getting_started/application/chatdb/chatdb.md:24 +#: 996b028a57db49099dd4560f713b9d57 msgid "![db plugins demonstration](../../../../assets/chat_data/db_connect.png)" msgstr "![db plugins demonstration](../../../../assets/chat_data/db_connect.png)" -#: ../../getting_started/application/chatdb/chatdb.md:17 -#: baaae5e3320742ea8def1144144ec2e0 +#: ../../getting_started/application/chatdb/chatdb.md:26 +#: 3ecdb59a329e44fdb69fde720c86de82 msgid "1.3 Add Datasource" msgstr "1.3 添加Datasource" -#: ../../getting_started/application/chatdb/chatdb.md:18 -#: 68dee774bfcd4c39ab9081c911d4af26 +#: ../../getting_started/application/chatdb/chatdb.md:28 +#: 9e1a14be9a75473ca73fb463d52eb688 msgid "" "![db plugins " "demonstration](../../../../assets/chat_data/add_datasource.png)" @@ -101,13 +103,38 @@ msgstr "" "![db plugins " "demonstration](../../../../assets/chat_data/add_datasource.png)" -#: ../../getting_started/application/chatdb/chatdb.md:19 -#: 30df69cad4fe41da8d1aefe0b8f7b963 +#: ../../getting_started/application/chatdb/chatdb.md:31 +#: 9e7471c68e2849438cfb8838ab2936df +msgid "now DB-GPT support Datasource Type" +msgstr "DB-GPT支持数据源类型" + +#: ../../getting_started/application/chatdb/chatdb.md:32 +#: cec1011e56d543219cddd38a461c8c96 +msgid "Mysql" +msgstr "Mysql" + +#: ../../getting_started/application/chatdb/chatdb.md:33 +#: f2aa6b4365a44a729bc7effa472ac2d5 +msgid "Sqlite" +msgstr "Sqlite" + +#: ../../getting_started/application/chatdb/chatdb.md:34 +#: 9695394c8509482ab86e96fead3d11ca +msgid "DuckDB" +msgstr "DuckDB" + +#: ../../getting_started/application/chatdb/chatdb.md:35 +#: 92a13f0678764840842c140d244cebe9 +msgid "Clickhouse" +msgstr "Clickhouse" + +#: ../../getting_started/application/chatdb/chatdb.md:38 +#: 727244f8ae0b4cb7a8a7aa13c17e717e msgid "2.ChatData" msgstr "2.ChatData" -#: ../../getting_started/application/chatdb/chatdb.md:20 -#: a2f838d667b24ad9a70bb21d5f47dd55 +#: ../../getting_started/application/chatdb/chatdb.md:40 +#: 165eb7ebefcd4bd0aabc5d664f3c86b1 msgid "" "After successfully setting up the data source, you can start conversing " "with the database. You can ask it to generate SQL for you or inquire " @@ -117,13 +144,13 @@ msgstr "" "设置数据源成功后就可以和数据库进行对话了。你可以让它帮你生成SQL,也可以和问它数据库元数据的相关信息。 ![db plugins " "demonstration](../../../../assets/chat_data/chatdata_eg.png)" -#: ../../getting_started/application/chatdb/chatdb.md:23 -#: eaa6f5302da242c7a41346610f7234e8 +#: ../../getting_started/application/chatdb/chatdb.md:44 +#: 1562102c112248aab781dd58f7f328dd msgid "3.ChatDB" msgstr "3.ChatDB" -#: ../../getting_started/application/chatdb/chatdb.md:24 -#: 217eefe88eb5425fb8cb481df133157c +#: ../../getting_started/application/chatdb/chatdb.md:45 +#: 8cbcf39784464bc1b62abf10f17658cc msgid "![db plugins demonstration](../../../../assets/chat_data/chatdb_eg.png)" msgstr "![db plugins demonstration](../../../../assets/chat_data/chatdb_eg.png)" diff --git a/docs/locales/zh_CN/LC_MESSAGES/getting_started/application/dashboard/dashboard.po b/docs/locales/zh_CN/LC_MESSAGES/getting_started/application/dashboard/dashboard.po index 74aef14b8..5b94c4b09 100644 --- a/docs/locales/zh_CN/LC_MESSAGES/getting_started/application/dashboard/dashboard.po +++ b/docs/locales/zh_CN/LC_MESSAGES/getting_started/application/dashboard/dashboard.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: DB-GPT 👏👏 0.3.5\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-08-21 16:59+0800\n" +"POT-Creation-Date: 2023-08-22 13:28+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: zh_CN\n" @@ -33,121 +33,125 @@ msgid "" " language and gain insights into their respective areas of business." msgstr "DB-GPT Dashboard目的是赋能数据分析人员。DB-GPT通过提供智能报表技术,使得业务分析人员可以直接使用简单的自然语言进行自助分析。" -#: ../../getting_started/application/dashboard/dashboard.md:6 +#: ../../getting_started/application/dashboard/dashboard.md:8 #: 48604cca2b3f482692bb65a01f0297a7 msgid "Dashboard now support Datasource Type" msgstr "Dashboard目前支持的数据源类型" -#: ../../getting_started/application/dashboard/dashboard.md:7 +#: ../../getting_started/application/dashboard/dashboard.md:9 #: e4371bc220be46f0833dc7d0c804f263 msgid "Mysql" msgstr "Mysql" -#: ../../getting_started/application/dashboard/dashboard.md:8 +#: ../../getting_started/application/dashboard/dashboard.md:10 #: 719c578796fa44a3ad062289aa4650d7 msgid "Sqlite" msgstr "Sqlite" -#: ../../getting_started/application/dashboard/dashboard.md:9 +#: ../../getting_started/application/dashboard/dashboard.md:11 #: c7817904bbf34dfca56a19a004937146 msgid "DuckDB" msgstr "DuckDB" -#: ../../getting_started/application/dashboard/dashboard.md:11 +#: ../../getting_started/application/dashboard/dashboard.md:13 #: 1cebeafe853d43809e6ced45d2b68812 msgid "Steps to Dashboard In DB-GPT" msgstr "Dashboard使用步骤" -#: ../../getting_started/application/dashboard/dashboard.md:14 +#: ../../getting_started/application/dashboard/dashboard.md:15 #: 977520bbea44423ea290617712482148 msgid "1 add datasource" msgstr "1.添加数据源" -#: ../../getting_started/application/dashboard/dashboard.md:15 +#: ../../getting_started/application/dashboard/dashboard.md:17 #: a8fcef153c68498fa9886051e8d7b072 +#, fuzzy msgid "" "If you are using Dashboard for the first time, you need to mock some data" " to test. DB-GPT provide some dashboard test data in pilot/mock_datas/, " "you should follow the steps. ![add_datasource](https://github.com" -"/eosphoros-ai/DB-" -"GPT/assets/13723926/043da0c1-70a0-4a26-9aa0-5aa34fd07a5c)" +"/eosphoros-ai/DB-GPT/assets/13723926/0afc72ea-83c8-45ff-" +"8c36-213b1c6fb5dd)" msgstr "如果你是第一次使用Dashboard,需要构造测试数据,DB-GPT在pilot/mock_datas/提供了测试数据,只需要将数据源进行添加即可" -#: ../../getting_started/application/dashboard/dashboard.md:15 +#: ../../getting_started/application/dashboard/dashboard.md:17 #: 1abcaa9d7fad4b53a0622ab3e982e6d5 msgid "add_datasource" msgstr "添加数据源" -#: ../../getting_started/application/dashboard/dashboard.md:19 +#: ../../getting_started/application/dashboard/dashboard.md:21 #: 21ebb5bf568741a9b3d7a4275dde69fa msgid "2.Choose Dashboard Mode" msgstr "2.进入Dashboard" -#: ../../getting_started/application/dashboard/dashboard.md:20 +#: ../../getting_started/application/dashboard/dashboard.md:23 #: 1b55d97634b44543acf8f367f77d8436 msgid "" "![create_space](https://github.com/eosphoros-ai/DB-" "GPT/assets/13723926/5e888880-0e97-4b60-8e5c-b7e7224197f0)" -msgstr "![create_space](https://github.com/eosphoros-ai/DB-" +msgstr "" +"![create_space](https://github.com/eosphoros-ai/DB-" "GPT/assets/13723926/5e888880-0e97-4b60-8e5c-b7e7224197f0)" -#: ../../getting_started/application/dashboard/dashboard.md:20 +#: ../../getting_started/application/dashboard/dashboard.md:23 #: 6c97d2aa26fa401cb3c4172bfe4aea6a msgid "create_space" msgstr "create_space" -#: ../../getting_started/application/dashboard/dashboard.md:23 +#: ../../getting_started/application/dashboard/dashboard.md:25 #: ff8e96f78698428a9a578b4f90e0feb4 msgid "3.Select Datasource" msgstr "3.选择数据源" -#: ../../getting_started/application/dashboard/dashboard.md:24 +#: ../../getting_started/application/dashboard/dashboard.md:27 #: 277c924a6f2b49f98414cde95310384f msgid "" "![document](https://github.com/eosphoros-ai/DB-" "GPT/assets/13723926/da2ac8b5-eca4-48ef-938f-f9dc1ca711b3)" -msgstr "![document](https://github.com/eosphoros-ai/DB-" +msgstr "" +"![document](https://github.com/eosphoros-ai/DB-" "GPT/assets/13723926/da2ac8b5-eca4-48ef-938f-f9dc1ca711b3)" -#: ../../getting_started/application/dashboard/dashboard.md:24 #: ../../getting_started/application/dashboard/dashboard.md:27 +#: ../../getting_started/application/dashboard/dashboard.md:31 #: 33164f10fb38452fbf98be5aabaeeb91 3a46cb4427cf4ba386230dff47cf7647 #: d0093988bb414c41a93e8ad6f88e8404 msgid "document" msgstr "document" -#: ../../getting_started/application/dashboard/dashboard.md:26 +#: ../../getting_started/application/dashboard/dashboard.md:29 #: 6a57e48482724d23adf51e888d126562 msgid "4.Input your analysis goals" msgstr "4.输入分析目标" -#: ../../getting_started/application/dashboard/dashboard.md:27 +#: ../../getting_started/application/dashboard/dashboard.md:31 #: cb96df3f9135450fbf71177978c50141 msgid "" "![document](https://github.com/eosphoros-ai/DB-" "GPT/assets/13723926/3f427350-5bd5-4675-8f89-1bd5c63ff2c6) " "![document](https://github.com/eosphoros-ai/DB-GPT/assets/13723926" "/3d14a2da-165e-4b2f-a921-325c20fe5ae9)" -msgstr "![document](https://github.com/eosphoros-ai/DB-" +msgstr "" +"![document](https://github.com/eosphoros-ai/DB-" "GPT/assets/13723926/3f427350-5bd5-4675-8f89-1bd5c63ff2c6) " "![document](https://github.com/eosphoros-ai/DB-GPT/assets/13723926" "/3d14a2da-165e-4b2f-a921-325c20fe5ae9)" -#: ../../getting_started/application/dashboard/dashboard.md:31 +#: ../../getting_started/application/dashboard/dashboard.md:34 #: ed0f008525334a36a900b82339591095 msgid "5.Adjust and modify your report" msgstr "5.调整" - -#: ../../getting_started/application/dashboard/dashboard.md:34 +#: ../../getting_started/application/dashboard/dashboard.md:36 #: 8fc26117a2e1484b9452cfaf8c7f208b msgid "" "![upload](https://github.com/eosphoros-ai/DB-GPT/assets/13723926/cb802b94" "-041b-44b4-b6ec-891bf8da52a4)" -msgstr "![upload](https://github.com/eosphoros-ai/DB-GPT/assets/13723926/cb802b94" +msgstr "" +"![upload](https://github.com/eosphoros-ai/DB-GPT/assets/13723926/cb802b94" "-041b-44b4-b6ec-891bf8da52a4)" -#: ../../getting_started/application/dashboard/dashboard.md:34 +#: ../../getting_started/application/dashboard/dashboard.md:36 #: 6d12166c3c574651a854534cc8c7e997 msgid "upload" msgstr "upload" diff --git a/docs/locales/zh_CN/LC_MESSAGES/getting_started/faq/chatdb/chatdb_faq.po b/docs/locales/zh_CN/LC_MESSAGES/getting_started/faq/chatdb/chatdb_faq.po index b0084b477..38cb58cc1 100644 --- a/docs/locales/zh_CN/LC_MESSAGES/getting_started/faq/chatdb/chatdb_faq.po +++ b/docs/locales/zh_CN/LC_MESSAGES/getting_started/faq/chatdb/chatdb_faq.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: DB-GPT 👏👏 0.3.5\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-08-16 23:15+0800\n" +"POT-Creation-Date: 2023-08-22 13:28+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: zh_CN\n" @@ -20,17 +20,17 @@ msgstr "" "Generated-By: Babel 2.12.1\n" #: ../../getting_started/faq/chatdb/chatdb_faq.md:1 -#: ffd1abb6b8f34e53a8ed83ede845b141 +#: 371f153c45484caea125cc4841a3ab7c msgid "Chat DB FAQ" msgstr "Chat DB FAQ" #: ../../getting_started/faq/chatdb/chatdb_faq.md:3 -#: 2467f6603ab341bbb1ce17f75dc06e5e +#: f5d4e14316ef4d6db20b76872768b012 msgid "Q1: What difference between ChatData and ChatDB" msgstr "" #: ../../getting_started/faq/chatdb/chatdb_faq.md:4 -#: 6e47803e92064e379a1bb74e2b3d347a +#: ee16d1c26d54456ba5cc51f0f5fb82fe msgid "" "ChatData generates SQL from natural language and executes it. ChatDB " "involves conversing with metadata from the Database, including metadata " @@ -38,25 +38,39 @@ msgid "" msgstr "ChatData 是将自然语言转换成SQL并执行获取结果,ChatDB主要是和数据库元数据信息(包括表、字段、索引信息), 用于db诊断和数据库答疑" #: ../../getting_started/faq/chatdb/chatdb_faq.md:6 -#: fa3eef15697f43db963f6c875e85323b +#: a65f2f4603e44a8396d84daa78ba337d msgid "Q2: The suitable llm model currently supported for text-to-SQL is?" msgstr "Q2: 目前DB-GPT最适合text-to-SQL的开源模型是什么" #: ../../getting_started/faq/chatdb/chatdb_faq.md:7 -#: 47f36a0a48c045269bcf790873d55f8c +#: 77763b99ef924e2b90961e550f5c3d88 msgid "Now vicunna-13b-1.5 and llama2-70b is more suitable for text-to-SQL." msgstr "vicunna-13b-1.5 和 llama2-70b" #: ../../getting_started/faq/chatdb/chatdb_faq.md:9 -#: 9f5ef9a05fac4eb3b27875171ec4e763 +#: 776a487a2c624cfdbf59fdb64a5649f5 msgid "Q3: How to fine-tune Text-to-SQL in DB-GPT" msgstr "Q3: 我想fine-tune Text-to-SQL in DB-GPT" #: ../../getting_started/faq/chatdb/chatdb_faq.md:10 -#: c9b6f6e969e04805a59d9ccabc03c0b8 +#: 17ae1a5ee4234d3b86940d179262f37b msgid "" "there is another github project for Text-to-SQL fine-tune " "(https://github.com/eosphoros-ai/DB-GPT-Hub)" -msgstr "参与另外一个项目 Text-to-SQL fine-tune " -"(https://github.com/eosphoros-ai/DB-GPT-Hub)" +msgstr "" +"参与另外一个项目 Text-to-SQL fine-tune (https://github.com/eosphoros-ai/DB-GPT-" +"Hub)" + +#: ../../getting_started/faq/chatdb/chatdb_faq.md:12 +#: d34324bce192484a8afe066f22854801 +msgid "" +"Q4: chatdata with clickhouse clickhouse-sqlalchemy 0.2.4 requires " +"sqlalchemy<1.5,>=1.4.24, but you have sqlalchemy 2.0.20 which is " +"incompatible" +msgstr "chatData 使用clickhouse时发现driver与clickhouse-sqlalchemy不兼容" + +#: ../../getting_started/faq/chatdb/chatdb_faq.md:13 +#: e3746b0538b045e883cfbb17b0177f04 +msgid "Just set sqlalchemy<1.5,>=1.4.24" +msgstr "调整下版本 sqlalchemy<1.5,>=1.4.24" diff --git a/pilot/common/schema.py b/pilot/common/schema.py index eb25fe5e9..75f9b05a5 100644 --- a/pilot/common/schema.py +++ b/pilot/common/schema.py @@ -29,6 +29,7 @@ class DBType(Enum): Oracle = DbInfo("oracle") MSSQL = DbInfo("mssql") Postgresql = DbInfo("postgresql") + Clickhouse = DbInfo("clickhouse") def value(self): return self._value_.name diff --git a/pilot/connections/manages/connection_manager.py b/pilot/connections/manages/connection_manager.py index 6dc1a0222..27aca6f85 100644 --- a/pilot/connections/manages/connection_manager.py +++ b/pilot/connections/manages/connection_manager.py @@ -11,6 +11,7 @@ from pilot.connections.rdbms.conn_duckdb import DuckDbConnect from pilot.connections.rdbms.conn_sqlite import SQLiteConnect from pilot.connections.rdbms.conn_mssql import MSSQLConnect from pilot.connections.rdbms.base import RDBMSDatabase +from pilot.connections.rdbms.conn_clickhouse import ClickhouseConnect from pilot.singleton import Singleton from pilot.common.sql_database import Database from pilot.connections.db_conn_info import DBConfig diff --git a/pilot/connections/rdbms/conn_clickhouse.py b/pilot/connections/rdbms/conn_clickhouse.py new file mode 100644 index 000000000..0433b4b76 --- /dev/null +++ b/pilot/connections/rdbms/conn_clickhouse.py @@ -0,0 +1,108 @@ +import re +from typing import Optional, Any +from sqlalchemy import text + +from pilot.connections.rdbms.base import RDBMSDatabase + + +class ClickhouseConnect(RDBMSDatabase): + """Connect Clickhouse Database fetch MetaData + Args: + Usage: + """ + + """db type""" + db_type: str = "clickhouse" + """db driver""" + driver: str = "clickhouse" + """db dialect""" + db_dialect: str = "clickhouse" + + @classmethod + def from_uri_db( + cls, + host: str, + port: int, + user: str, + pwd: str, + db_name: str, + engine_args: Optional[dict] = None, + **kwargs: Any, + ) -> RDBMSDatabase: + db_url: str = ( + cls.driver + + "://" + + user + + ":" + + pwd + + "@" + + host + + ":" + + str(port) + + "/" + + db_name + ) + return cls.from_uri(db_url, engine_args, **kwargs) + + def get_indexes(self, table_name): + """Get table indexes about specified table.""" + return "" + + def get_show_create_table(self, table_name): + """Get table show create table about specified table.""" + session = self._db_sessions() + cursor = session.execute(text(f"SHOW CREATE TABLE {table_name}")) + ans = cursor.fetchall() + ans = ans[0][0] + ans = re.sub(r"\s*ENGINE\s*=\s*MergeTree\s*", " ", ans, flags=re.IGNORECASE) + ans = re.sub( + r"\s*DEFAULT\s*CHARSET\s*=\s*\w+\s*", " ", ans, flags=re.IGNORECASE + ) + ans = re.sub(r"\s*SETTINGS\s*\s*\w+\s*", " ", ans, flags=re.IGNORECASE) + return ans + + def get_fields(self, table_name): + """Get column fields about specified table.""" + session = self._db_sessions() + cursor = session.execute( + text( + f"SELECT name, type, default_expression, is_in_primary_key, comment from system.columns where table='{table_name}'".format( + table_name + ) + ) + ) + fields = cursor.fetchall() + return [(field[0], field[1], field[2], field[3], field[4]) for field in fields] + + def get_users(self): + return [] + + def get_grants(self): + return [] + + def get_collation(self): + """Get collation.""" + return "UTF-8" + + def get_charset(self): + return "UTF-8" + + def get_database_list(self): + return [] + + def get_database_names(self): + return [] + + def get_table_comments(self, db_name): + session = self._db_sessions() + cursor = session.execute( + text( + f"""SELECT table, comment FROM system.tables WHERE database = '{db_name}'""".format( + db_name + ) + ) + ) + table_comments = cursor.fetchall() + return [ + (table_comment[0], table_comment[1]) for table_comment in table_comments + ] diff --git a/pilot/openapi/api_v1/api_v1.py b/pilot/openapi/api_v1/api_v1.py index 1d01b31b6..b967e41ac 100644 --- a/pilot/openapi/api_v1/api_v1.py +++ b/pilot/openapi/api_v1/api_v1.py @@ -118,7 +118,13 @@ async def db_connect_delete(db_name: str = None): @router.get("/v1/chat/db/support/type", response_model=Result[DbTypeInfo]) async def db_support_types(): - support_types = [DBType.Mysql, DBType.MSSQL, DBType.DuckDb, DBType.SQLite] + support_types = [ + DBType.Mysql, + DBType.MSSQL, + DBType.DuckDb, + DBType.SQLite, + DBType.Clickhouse, + ] db_type_infos = [] for type in support_types: db_type_infos.append(