cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

import pymssql fails on DLT Serverless

Prashant2
New Contributor II

I have a delta live table pipeline which works fine on normal DLT job cluster.

But as soon as we switch it to use serverless compute it fails.

The failure happens at "import pymssql" after doing pip install pymssql as first statement of the source code notebook of the DLT Pipeline.

The error message is not helpful at all, but i tried to narrow it down to this statement after number of executions.

Is it a bug in DLT Serverless runtime? the same code works on serverless spark cluster as well

4 REPLIES 4

lingareddy_Alva
Honored Contributor II

@Prashant2 

You're encountering an important limitation of Databricks DLT pipelines on Serverless Compute: currently, custom Python package installation using pip install within the notebook is not supported in DLT Serverless.
This is not a bug, but rather a limitation by design.

In Serverless DLT, the runtime environment is managed and hardened, and it does not allow arbitrary package installations at notebook execution time for:
- Security
- Stability
- Faster cold start times

While a regular serverless cluster (like for interactive notebooks or jobs) allows pip install,
DLT Serverless pipelines have restricted environments and must use packages that are:
- Pre-installed in the serverless runtime, or
- Packaged via a custom wheel or installed via a requirements.txt at deployment time (not inside the notebook)

 

LR

eniwoke
New Contributor III

Hi @Prashant2 I am curious to know how you installed the library in your notebook. Did you use

%pip install pymssql

If so, could you try using a shell command instead, like:

!pip install pymssql

Iโ€™ve had success using !pip install in serverless compute environments + dlt serverless jobs. For example, I recently installed weasyprint this way and was able to use it in a UDF for my final Delta Live Table.

Let me know if that works for you!

eniwoke_0-1746311602150.png

 

Eni

Prashant2
New Contributor II

Thanks for your response Eni, appreciate it.

i did try both % and !
It seems the problem is with the compatibility of pymssql library with the DLT serverless compute specifically , as i am able to install and run import other libraries from pip but not pymssql

From driver logs it appears that the pip install for pymssql succeeds successfully for fails to run the import statement due to some compatibility with the DLT serverless compute runtime 

You may try it in your sample pipeline as well

eniwoke
New Contributor III

Hi @Prashant2, you are right, I just tried as well in my pipeline and i get an error at the import statement after installing pymssql library

eniwoke_0-1746378641232.png

If it is not too much, you can try with pyodbc, seems to work.

eniwoke_1-1746379627515.png

 

Eni

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now