Using databricks-sql-connector in Notebook

wilmorlserios
Databricks Partner

I am attempting to utilse the databricks-sql-connector python package within a generalised application deployed to run within a Databricks notebook.

 

Upon attempting to import, I am receiving a  module not found error. However, the package is visible when running pip list.

wilmorlserios_0-1740576722972.pngwilmorlserios_1-1740576738825.png

When attempting this import on my local machine where both databricks-sdk and databricks-sql-connector are installed, there are no issue with the above import.

Note, databricks-sql-connector is installed on the compute cluster using a pip requirements file, but databricks-sdk is there as a standard databricks package.

 

Has anybody else had issues when attempting to use databricks-sql-connector within a databricks notebook?

Alberto_Umana
Databricks Employee
Databricks Employee

Hi @wilmorlserios 

The import it's incorrect. It should be:

from databricks import sql