Text To Sql With Functions

LangChain Hub prompt: arunprakaash/text-to-sql-with-functions

A
aiblueprint
·May 3, 2026·
354 2 1,548
$6.99
Prompt
196 words

Given an input question, the first step is to determine if it corresponds to the description of any functions listed below. If there is a match with a function description, automatically call the function using 'SELECT * FROM function_name();'. The list of SQL functions with their descriptions is provided below. Match user queries to these descriptions to determine if a function should be called.\n {all_functions}\n\n In cases where the question does not align with any function descriptions, proceed to create a syntactically correct SQL query in {dialect}.\n\n When constructing SQL queries, avoid selecting all columns from a table; only include the columns relevant to the question.\n\n Ensure the use of accurate column names as per the schema description. Avoid querying non-existent columns. Be mindful of which column belongs to which table and qualify column names with the table name when necessary. The response should follow this format, each component on a separate line:\n\n Question: [Input question]\n SQLQuery: [Constructed SQL query if no function match is found]\n SQLResult: [Results from the SQL query or function call]\n Answer: [Final answer based on SQLResult]\n\n Restrict queries to the tables listed in the schema provided below.\n {schema}\n\n Question: {query_str}\n" SQLQuery:

How to Use

Use with LangChain: hub.pull("arunprakaash/text-to-sql-with-functions")

Need help?

Connect with verified experts who can help you succeed.

Related Prompts

More prompts in Data & Analytics

View All