|
1 | | -DATABASE_SUMMARY_OUTPUT_EXAMPLE = """You are a business database expert. Please generate a {{language}} database summary based on the following table structure, with the aim of helping people understand what information this database can provide from a business perspective. |
2 | | -
|
3 | | -## Table Schema |
4 | | -{{ddl_sql}} |
5 | | -
|
6 | | -## Output Example |
7 | | -
|
8 | | -This database is the core data model of a typical e-commerce system, |
9 | | -including modules for user management, product management, order transactions, |
10 | | -payment processes, and address management. |
11 | | -
|
12 | | -It achieves a complete business loop through multi-table associations |
13 | | -(such as user-order-product-payment), supporting users throughout |
14 | | -the entire process from registration, browsing products, |
15 | | -placing orders and making payments to receiving goods. |
16 | | -
|
17 | | -Each table ensures data consistency through foreign key constraints |
18 | | -(such as the strong association between orders and users or addresses) |
19 | | -and includes timestamp fields (`created_at`/`updated_at`) for tracking data changes. |
20 | | -
|
21 | | -Now, You only need to output a descriptive text in {{language}}. |
22 | | -""" |
23 | | - |
24 | | -QUESTION_CONVERT_SQL = """The following is the table structure in the database and some common query SQL statements. Please convert the user's question into an SQL query statement. Note to comply with sqlite syntax. Do not explain, just provide the SQL directly. |
25 | | -
|
26 | | -Database System: {{dialect_name}} |
27 | | -
|
28 | | -## Table Schema |
29 | | -```sql |
30 | | -{{table_schema}} |
31 | | -``` |
32 | | -
|
33 | | -## Data Example |
34 | | -```sql |
35 | | -{{sample_data}} |
36 | | -``` |
37 | | -## Few-Shot Example |
38 | | -{{qa_pairs}} |
39 | | -
|
40 | | -## User Question |
41 | | -{{question}} |
42 | | -
|
43 | | -## Instructions |
44 | | -1. Follow {{dialect_name}} syntax |
45 | | -2. Do not provide explanations, just give the SQL statement directly |
46 | | -""" |
| 1 | +import textwrap |
| 2 | + |
| 3 | + |
| 4 | +class PromptTemplates: |
| 5 | + DATABASE_SUMMARY_OUTPUT_EXAMPLE = textwrap.dedent(""" |
| 6 | + You are a business database expert. Please generate a {{language}} database summary based on the following table structure, with the aim of helping people understand what information this database can provide from a business perspective. |
| 7 | + |
| 8 | + ## Table Schema |
| 9 | + {{ddl_sql}} |
| 10 | + |
| 11 | + ## Output Example |
| 12 | + |
| 13 | + This database is the core data model of a typical e-commerce system, |
| 14 | + including modules for user management, product management, order transactions, |
| 15 | + payment processes, and address management. |
| 16 | + |
| 17 | + It achieves a complete business loop through multi-table associations |
| 18 | + (such as user-order-product-payment), supporting users throughout |
| 19 | + the entire process from registration, browsing products, |
| 20 | + placing orders and making payments to receiving goods. |
| 21 | + |
| 22 | + Each table ensures data consistency through foreign key constraints |
| 23 | + (such as the strong association between orders and users or addresses) |
| 24 | + and includes timestamp fields (`created_at`/`updated_at`) for tracking data changes. |
| 25 | + |
| 26 | + Now, You only need to output a descriptive text in {{language}}. |
| 27 | + """) |
| 28 | + |
| 29 | + QUESTION_CONVERT_SQL = textwrap.dedent(""" |
| 30 | + The following is the table structure in the database and some common query SQL statements. Please convert the user's question into an SQL query statement. Note to comply with sqlite syntax. Do not explain, just provide the SQL directly. |
| 31 | + |
| 32 | + Database System: {{dialect_name}} |
| 33 | + |
| 34 | + ## Table Schema |
| 35 | + ```sql |
| 36 | + {{table_schema}} |
| 37 | + ``` |
| 38 | + |
| 39 | + ## Data Example |
| 40 | + ```sql |
| 41 | + {{sample_data}} |
| 42 | + ``` |
| 43 | + ## Few-Shot Example |
| 44 | + {{qa_pairs}} |
| 45 | + |
| 46 | + ## User Question |
| 47 | + {{question}} |
| 48 | + |
| 49 | + ## Instructions |
| 50 | + 1. Follow {{dialect_name}} syntax |
| 51 | + 2. Do not provide explanations, just give the SQL statement directly |
| 52 | + """) |
0 commit comments