langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Support Databricks in SQLDatabase

Open gengliangwang opened this issue 2 years ago • 1 comments
trafficstars

This PR adds support for Databricks runtime and Databricks SQL by using Databricks SQL Connector for Python. As a cloud data platform, accessing Databricks requires a URL as follows databricks://token:{api_token}@{hostname}?http_path={http_path}&catalog={catalog}&schema={schema}.

The URL is complicated and it may take users a while to figure it out. Since the fields api_token/hostname/http_path fields are known in the Databricks notebook, I am proposing a new method from_databricks to simplify the connection to Databricks.

In Databricks Notebook

After changes, Databricks users only need to specify the catalog and schema field when using langchain. image

In Jupyter Notebook

The method can be used on the local setup as well: image

gengliangwang avatar May 15 '23 02:05 gengliangwang

cc @vowelparrot @hwchase17 @mengxr

gengliangwang avatar May 15 '23 02:05 gengliangwang