4

I am trying to import another module or package in my databricks delta live tables notebook and I am getting an error saying that %run or any magic command is not supported. Just wondering if there is any other way to import the modules or packages.

Abhy
  • 61
  • 5

2 Answers2

3

As of right now, Delta Live Tables supports installation of libraries via %pip (documentation), so you need to package your code as Python libraries and install it with %pip.

Repos integration is coming

Update: April 2023rd. Files in Repos are fully supported since December 2022. See this blog post for example

Alex Ott
  • 80,552
  • 8
  • 87
  • 132
  • Hi, as you know repos feature it's been out for a long, can I now import the python module from another notebook in dlt? – Shahrukh lodhi Oct 10 '22 at 07:00
  • 1
    No, although repos are supported for a long on Databricks itself, integration with DLT is still in work... – Alex Ott Oct 10 '22 at 09:28
  • Great answer. I've added a Databricks idea for this functionality in case it helps to track there: https://ideas.databricks.com/ideas/DBE-I-1096 – Cameron Lee Apr 24 '23 at 18:49
  • @CameronLee files in repos are supported since December. I’ve added a note – Alex Ott Apr 24 '23 at 19:03
1

I could install my own python-packages (that I moved to the DBFS-FileStore before) as well as packages from pip by placing a cell like this at the top of my notebook:

! pip install /dbfs/FileStore/...

and

! pip install openpyxl
Gerold Busch
  • 181
  • 3