Function
optimize_sql_query
(sql_query, database_structure)
Source from the content-addressed store, hash-verified
| 36 | |
| 37 | |
| 38 | def optimize_sql_query(sql_query, database_structure): |
| 39 | prompt = f"Optimize the following SQL query:\n\n{sql_query}\n\nusing the database structure:\n\n{database_structure}" |
| 40 | response = openai.Completion.create( |
| 41 | engine="davinci", |
| 42 | prompt=prompt, |
| 43 | max_tokens=100 |
| 44 | ) |
| 45 | return response.choices[0].text.strip() |
| 46 | |
| 47 | |
| 48 | if __name__ == '__main__': |
Tested by
no test coverage detected