cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

port undefined error in SQLDatabase.from_databricks (langchain.sql_database)

Octavian1
Contributor

The following assignment:

from langchain.sql_database import SQLDatabase

dbase = SQLDatabase.from_databricks(
catalog=catalog,
schema=db,
host=host,
api_token=token,
)

fails with 

ValueError: invalid literal for int() with base 10: ''
because of
cls._assert_port(port),
in /lib/python3.10/site-packages/sqlalchemy/engine/url.py:211, in URL.create(cls, drivername, username, password, host, port, database, query)
as shown in the error trace.
 
Couldn't find any information regarding this (for instance, in the example given in: https://docs.gcp.databricks.com/en/large-language-models/langchain.html)
 
The token and host are OK. Also the catalog and schema have correct values.
 
Using langchain==0.1.5.

 

3 REPLIES 3

Hi @Retired_mod 

You may be right regarding SQLAlchemy, the trace hints at something related:

> /lib/python3.10/site-packages/langchain_community/utilities/sql_database.py", line 133, in from_uri

> """Construct a SQLAlchemy engine from URI."""

But I don't get why in the SQLDatabase.from_databricks documentation there is no mention of any port parameter, neither in the example notebooks?

Thanks,

Octavian

vburam
New Contributor II

I am also facing the same issue. not able to connect even after using sqlalchemy

vburam
New Contributor II

SQL alchemy url: databricks+https://<token>@abc.cloud.databricks.com:443/sql/1.0/warehouses/9265c8e0?catalog=customer&schema=chatbot

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group