Thompson2345
New Contributor III

The issue happens because SQLDatabase.from_databricks doesn’t automatically fetch column metadata from Unity Catalog tables in some LangChain versions, leading to malformed SELECT statements. A workaround is to manually query the catalog like you did (information_schema.columns) and pass the column info to LangChain, or use include_tables/table_metadata parameters if supported in your LangChain version. Also, ensure you’re using the latest langchain and databricks-sql-connector releases, as newer versions handle Unity Catalog metadata better.