Hi,
I am trying to connect my database through LLM and expecting to receive a description of the table and 1st 3 rows from the table.
from langchain.agents import create_sql_agent
from langchain.agents.agent_toolkits import SQLDatabaseToolkit
from langchain.sql_database import SQLDatabase
from langchain import OpenAI
from langchain.agents.agent_types import AgentType
db = SQLDatabase.from_databricks(catalog="hive_metastore", schema="my_data", host="*****.gcp.databricks.com",api_token="dapi*****")
llm = OpenAI(temperature=0.9)
toolkit = SQLDatabaseToolkit(db=db, llm=llm)
agent = create_sql_agent(llm=llm, toolkit=toolkit, verbose=True)
agent.run("describe silver_tableabc")
The error that I am facing:
DatabaseError: (databricks.sql.exc.ServerOperationError) [UNBOUND_SQL_PARAMETER] Found the unbound parameter: param_1. Please, fix `args` and provide a mapping of the parameter to either a SQL literal or collection constructor functions such as `map()`, `array()`, `struct()`. SQLSTATE: 42P02; line 3 pos 7
[SQL: SELECT silver_tableabc.health,silver_tableabc.cust_id,... FROM silver_tableabc
LIMIT :param_1]
[parameters: {'param_1': 3}]
(Background on this error at: https://sqlalche.me/e/20/4xp6)
Version:
- Cluster: 14.2ML ( even tried with general purpose 14.2, 13.3)
- Langchain: 0.0.348 (even tried with 0.0.341)
- SQLAlchemy: 2.0.12
databricks-sql-connector: 3.0.0
@Retired_mod COuld you please help me how can I resolve this?