-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Labels
enhancementNew feature or requestNew feature or requestpromptThe input provided by the user in natural language that serves as the basis for SQL generation.The input provided by the user in natural language that serves as the basis for SQL generation.
Milestone
Description
Why ❓
현재 상황:
- 현재
llm_utils/chains.py파일의create_query_maker_chain함수에서 Few-Shot SQL예제가 모든 DBMS에 동일하게 적용되고 있습니다.
Lines 90 to 104 in 36b5a88
| 최종 형태 예시: | |
| <SQL> | |
| ```sql | |
| SELECT COUNT(DISTINCT user_id) | |
| FROM stg_users | |
| ``` | |
| <해석> | |
| ```plaintext (max_length_per_line=100) | |
| 이 쿼리는 stg_users 테이블에서 고유한 사용자의 수를 계산합니다. | |
| 사용자는 유니크한 user_id를 가지고 있으며 | |
| 중복을 제거하기 위해 COUNT(DISTINCT user_id)를 사용했습니다. | |
| ``` | |
문제점 👿:
- DBMS마다 SQL 문법이 다르므로, 특정 DBMS에서는 올바르지 않은 SQL이 생성될 가능성이 있습니다.
How 🤔
- 해결 방안 ✅:
- DBMS에 따른
SQL-FewShot을 위 프롬프트에 추가하여 데이터베이스 환경에 맞는 올바른 쿼리를 생성하게 합니다. - DBMS에 따른 Syntax 용어 사전을 생성해 SQL 문법 구조를 반영하여 쿼리를 생성할 수 있습니다.
- DBMS에 따른
What 🛠️
- DBMS 종류 선정 논의
- Oracle, MySQL, PostgreSQL, DuckDB 등 종류 선정
- DBMS별 SQL 예제 맞춤화
- DBMS별 문법 차이 분석 (키워드 등)
- DBMS별 예제 코드 정의 및 추가 -
best_practice_query에 따른 로깅이나 최적의 케이스 수동 추가
- DBMS Syntax 용어 사전 구현
- SQL 용어 사전 정의 - 함수 및 키워드에 따른 설명 작성
-
create_query_maker_chain과 용어 사전 결합을 통해 올바른 쿼리 생성
ParkGyeongTae
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpromptThe input provided by the user in natural language that serves as the basis for SQL generation.The input provided by the user in natural language that serves as the basis for SQL generation.