Movatterモバイル変換


[0]ホーム

URL:


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

Commit06d3768

Browse files
committed
address comments
1 parent176281e commit06d3768

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

‎ibis-server/app/mdl/knowledge.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
frompathlibimportPath
22

33
fromapp.model.data_sourceimportDataSource
4+
fromapp.model.errorimportErrorCode,WrenError
45

56
KNOWLEDGE_RESOURCE_PATH="resources/knowledge"
67

@@ -11,10 +12,18 @@ def __init__(self, data_source: DataSource):
1112

1213
defget_text_to_sql_rule(self)->str:
1314
rules_path=Path(f"{KNOWLEDGE_RESOURCE_PATH}/text_to_sql_rule.txt")
15+
ifnotrules_path.exists():
16+
raiseWrenError(
17+
ErrorCode.GENERIC_INTERNAL_ERROR,"Text to SQL rule not found."
18+
)
1419
returnrules_path.read_text()
1520

1621
defget_sql_instructions(self)->dict:
1722
instructions_path=Path(f"{KNOWLEDGE_RESOURCE_PATH}/instructions")
23+
ifnotinstructions_path.exists():
24+
raiseWrenError(
25+
ErrorCode.GENERIC_INTERNAL_ERROR,"SQL instructions path not found."
26+
)
1827
files= [fforfininstructions_path.iterdir()iff.is_file()]
1928

2029
ifself.data_source:
@@ -27,4 +36,8 @@ def get_sql_instructions(self) -> dict:
2736

2837
defget_sql_correction_rule(self)->str:
2938
rules_path=Path(f"{KNOWLEDGE_RESOURCE_PATH}/sql_correction_rule.txt")
39+
ifnotrules_path.exists():
40+
raiseWrenError(
41+
ErrorCode.GENERIC_INTERNAL_ERROR,"SQL correction rule not found."
42+
)
3043
returnrules_path.read_text()

‎ibis-server/resources/knowledge/sql_correction_rule.txt‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ If the generated SQL query can't be executed successfully against the target dat
4949
8. If a timeout or resource limit error occurs during execution, it could be due to the complexity of the query or the size of the data being processed. You may need to optimize the Wren SQL to reduce its complexity or limit the amount of data being processed.
5050
2. Modify the Wren SQL:
5151
1. Based on the identified error, modify the Wren SQL to correct the issues. This may involve changing the SQL syntax, adjusting the query structure, or using different SQL constructs that are supported by Wren engine and the target database.
52-
2. You can onlymodifiy the Wren SQL directly. You are not allowed to modify the Planned SQL or Dialect SQL generated by Wren engine. So, you need to think about how to change the Wren SQL to achieve the desired Planned SQL or Dialect SQL.
52+
2. You can onlymodify the Wren SQL directly. You are not allowed to modify the Planned SQL or Dialect SQL generated by Wren engine. So, you need to think about how to change the Wren SQL to achieve the desired Planned SQL or Dialect SQL.
5353
3. Test the corrected SQL:
5454
1. Resubmit the modified Wren SQL to Wren engine and check if it executes successfully against the target database. If further errors occur, repeat the identification and modification steps until the SQL executes successfully.
5555
4. Validate the results:
@@ -58,4 +58,5 @@ If the generated SQL query can't be executed successfully against the target dat
5858
5. Report bugs:
5959
1. Try to avoid reporting bugs of Wren engine unless absolutely necessary. First, try to find an alternative way to write the Wren SQL to achieve the same result without triggering the bug or unsupported features.
6060
2. If no alternative and the generated SQL is reasonable and should be supported, but still fails due to internal issues of Wren engine, report the issue to the Wren support team for further investigation and resolution.
61-
3. If no alternative and a timeout or resource limit error occurs, report the issue to the user as an EXTERNAL ERROR, not a BUG of Wren engine. You may suggest the user to check their database performance or simpilify their question.
61+
3. If no alternative and a timeout or resource limit error occurs, report the issue to the user as an EXTERNAL ERROR, not a BUG of Wren engine. You may suggest the user to check their database performance or simplify their question.
62+
4. If no alternative and the error code is `GENERIC_INTERNAL_ERROR` or `SQLGLOT_ERROR` (it means transpiling error), report the issue to the Wren support team for further investigation and resolution.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp