mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-30 15:21:02 +00:00
# Description fix:#2437 Optimize the prompts for reconstructing data tables to ensure that the output field names comply with SQL standards, avoiding field names that start with numbers. # How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration # Snapshots: Include snapshots for easier review. # Checklist: - [x] My code follows the style guidelines of this project - [x] I have already rebased the commits and make the commit message conform to the project standard. - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] Any dependent changes have been merged and published in downstream modules
This commit is contained in:
commit
d6eb283e41
@ -52,9 +52,11 @@ with underscores
|
||||
4. If it's in other languages, translate them to English, and replace spaces with \
|
||||
underscores
|
||||
5. If it's special characters, delete them directly
|
||||
6. All column fields must be analyzed and converted, remember to output in JSON
|
||||
6. DuckDB adheres to the SQL standard, which requires that identifiers \
|
||||
(column names, table names) cannot start with a number.
|
||||
7. All column fields must be analyzed and converted, remember to output in JSON
|
||||
Avoid phrases like ' // ... (similar analysis for other columns) ...'
|
||||
7. You need to provide the original column names and the transformed new column names \
|
||||
8. You need to provide the original column names and the transformed new column names \
|
||||
in the JSON, as well as your analysis of the meaning and function of that column. If \
|
||||
it's a time type, please provide the time format, such as: \
|
||||
yyyy-MM-dd HH:MM:ss
|
||||
@ -111,9 +113,10 @@ DuckDB 表结构信息如下:
|
||||
3. 如果是中文,将中文字段名翻译为英文,并且将空格替换为下划线
|
||||
4. 如果是其它语言,将其翻译为英文,并且将空格替换为下划线
|
||||
5. 如果是特殊字符,直接删除
|
||||
6. 所以列的字段都必须分析和转换,切记在 JSON 中输出
|
||||
6. DuckDB遵循SQL标准,要求标识符(列名、表名)不能以数字开头
|
||||
7. 所以列的字段都必须分析和转换,切记在 JSON 中输出
|
||||
' // ... (其他列的类似分析) ...)' 之类的话术
|
||||
7. 你需要在json中提供原始列名和转化后的新的列名,以及你分析\
|
||||
8. 你需要在json中提供原始列名和转化后的新的列名,以及你分析\
|
||||
的该列的含义和作用,如果是时间类型请给出时间格式类似:\
|
||||
yyyy-MM-dd HH:MM:ss
|
||||
|
||||
|
@ -171,7 +171,10 @@ def read_from_df(
|
||||
|
||||
df = df.rename(columns=lambda x: x.strip().replace(" ", "_"))
|
||||
# write data in duckdb
|
||||
db.register(table_name, df)
|
||||
db.register("temp_df_table", df)
|
||||
# The table is explicitly created due to the issue at
|
||||
# https://github.com/eosphoros-ai/DB-GPT/issues/2437.
|
||||
db.execute(f"CREATE TABLE {table_name} AS SELECT * FROM temp_df_table")
|
||||
return table_name
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user