Prompts for AI-powered SQL query explanations.
Summary
Functions
Build the user prompt for explaining a fragment in context of the full query.
Generate system prompt for query explanation.
Build the user prompt for a full query explanation.
Functions
Build the user prompt for explaining a fragment in context of the full query.
The fragment is the portion the user highlighted/selected. The full query provides necessary context so the LLM can explain even isolated terms (e.g., a single JOIN clause, a HAVING condition, or a function call).
Parameters
fragment- The selected SQL fragment to explainfull_sql- The complete SQL query for contextschema_context- Optional schema context string
Generate system prompt for query explanation.
Parameters
database_type- Database type (e.g., :postgres, :mysql, :sqlite)
Build the user prompt for a full query explanation.
Parameters
sql- The full SQL query to explainschema_context- Optional schema context string