Spaces:
Runtime error
Runtime error
Commit ·
fb64f16
1
Parent(s): a978b21
indentation error removed
Browse files- queryHelperManager.py +3 -4
queryHelperManager.py
CHANGED
|
@@ -77,15 +77,14 @@ class QueryHelper:
|
|
| 77 |
def getSystemPromptForQueryGeneration(self, prospectTablesData, gptSampleRows):
|
| 78 |
schemaName = self.schemaName
|
| 79 |
platform = self.platform
|
| 80 |
-
|
| 81 |
-
SELECT a.customer_id, COUNT(a.product_id) as chandelier_count
|
| 82 |
FROM lpdatamart.tbl_f_sales a
|
| 83 |
JOIN lpdatamart.tbl_d_product b ON a.product_id = b.product_id
|
| 84 |
JOIN lpdatamart.tbl_d_calendar c ON a.date_id = c.date_id
|
| 85 |
WHERE UPPER(b.product_name) LIKE '%CHANDELIER%' AND c.calendar_month = 'NOVEMBER' AND c.year = 2023
|
| 86 |
GROUP BY a.customer_id
|
| 87 |
-
ORDER BY chandelier_count DESC
|
| 88 |
-
|
| 89 |
question = "top 5 customers who bought most chandeliers in nov 2023"
|
| 90 |
prompt = f"""Given an input text, generate the corresponding SQL query for given details. Schema Name is {schemaName}. And sql platform is {platform}.\n following is sample data. Also
|
| 91 |
There is example user input and desired generated sql query. Follow similar patterns as example. eg case insensitive, explicit variable declaration etc. user input : {question}, query : {exampleQuery} """
|
|
|
|
| 77 |
def getSystemPromptForQueryGeneration(self, prospectTablesData, gptSampleRows):
|
| 78 |
schemaName = self.schemaName
|
| 79 |
platform = self.platform
|
| 80 |
+
exampleQuery = """SELECT a.customer_id, COUNT(a.product_id) as chandelier_count
|
|
|
|
| 81 |
FROM lpdatamart.tbl_f_sales a
|
| 82 |
JOIN lpdatamart.tbl_d_product b ON a.product_id = b.product_id
|
| 83 |
JOIN lpdatamart.tbl_d_calendar c ON a.date_id = c.date_id
|
| 84 |
WHERE UPPER(b.product_name) LIKE '%CHANDELIER%' AND c.calendar_month = 'NOVEMBER' AND c.year = 2023
|
| 85 |
GROUP BY a.customer_id
|
| 86 |
+
ORDER BY chandelier_count DESC"""
|
| 87 |
+
|
| 88 |
question = "top 5 customers who bought most chandeliers in nov 2023"
|
| 89 |
prompt = f"""Given an input text, generate the corresponding SQL query for given details. Schema Name is {schemaName}. And sql platform is {platform}.\n following is sample data. Also
|
| 90 |
There is example user input and desired generated sql query. Follow similar patterns as example. eg case insensitive, explicit variable declaration etc. user input : {question}, query : {exampleQuery} """
|