<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to import a helper module that uses databricks specific modules (dbutils) in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-import-a-helper-module-that-uses-databricks-specific/m-p/32199#M23468</link>
    <description>&lt;P&gt;So the above resolved the issue? Please let us know if you still stuck. Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2022 18:42:15 GMT</pubDate>
    <dc:creator>Atanu</dc:creator>
    <dc:date>2022-09-13T18:42:15Z</dc:date>
    <item>
      <title>How to import a helper module that uses databricks specific modules (dbutils)</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-import-a-helper-module-that-uses-databricks-specific/m-p/32197#M23466</link>
      <description>&lt;P&gt;I have a main databricks notebook that runs a handful of functions. In this notebook, I import a &lt;A href="https://helper.py" alt="https://helper.py" target="_blank"&gt;helper.py&lt;/A&gt; file that is in my same repo and when I execute the import everything looks fine. Inside my &lt;A href="https://helper.py" alt="https://helper.py" target="_blank"&gt;helper.py&lt;/A&gt; there's a function that leverages built-in dbutils. Now back in my main notebook, when I try to execute the helper function that uses dbutils, I get an error: [NameError: name 'dbutils' is not defined]. How can I create a helper module that imports seamlessly and can leverage dbutils?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 01:31:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-import-a-helper-module-that-uses-databricks-specific/m-p/32197#M23466</guid>
      <dc:creator>mjbobak</dc:creator>
      <dc:date>2022-09-09T01:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to import a helper module that uses databricks specific modules (dbutils)</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-import-a-helper-module-that-uses-databricks-specific/m-p/32198#M23467</link>
      <description>&lt;P&gt;Looks like if I add the appropriate imports into the helper.py file then all is corrected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from pyspark.dbutils import DBUtils
from pyspark.sql import SparkSession
&amp;nbsp;
spark = SparkSession.builder.getOrCreate()
dbutils = DBUtils(spark)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 13:49:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-import-a-helper-module-that-uses-databricks-specific/m-p/32198#M23467</guid>
      <dc:creator>mjbobak</dc:creator>
      <dc:date>2022-09-09T13:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to import a helper module that uses databricks specific modules (dbutils)</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-import-a-helper-module-that-uses-databricks-specific/m-p/32199#M23468</link>
      <description>&lt;P&gt;So the above resolved the issue? Please let us know if you still stuck. Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 18:42:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-import-a-helper-module-that-uses-databricks-specific/m-p/32199#M23468</guid>
      <dc:creator>Atanu</dc:creator>
      <dc:date>2022-09-13T18:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to import a helper module that uses databricks specific modules (dbutils)</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-import-a-helper-module-that-uses-databricks-specific/m-p/32200#M23469</link>
      <description>&lt;P&gt;All set. issue resolved&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 18:43:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-import-a-helper-module-that-uses-databricks-specific/m-p/32200#M23469</guid>
      <dc:creator>mjbobak</dc:creator>
      <dc:date>2022-09-13T18:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to import a helper module that uses databricks specific modules (dbutils)</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-import-a-helper-module-that-uses-databricks-specific/m-p/32201#M23470</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;i 'm facing  similiar issue, when deploying via dbx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an helper notebook,  that when executing it via jobs works fine (without any includes)&lt;/P&gt;&lt;P&gt;while i deploy it via dbx (to same cluster), the helper notebook results with&lt;/P&gt;&lt;P&gt;dbutils.fs.ls(path)&lt;/P&gt;&lt;P&gt;NameError: name 'dbutils' is not defined&lt;/P&gt;&lt;P&gt;(for main notebook, that callse the helper function notebook, i have dbutils.widgets, and it doesnt have any issue)&lt;/P&gt;&lt;P&gt;(dbx execute my-task --task=silver --cluster-name="my-multi-cluster": builds a wheel and deploy on the databricks cluster)&lt;/P&gt;&lt;P&gt;adding the includes suggesetd dont resolve the issue.&lt;/P&gt;&lt;P&gt;any advise?&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Amir&lt;/P&gt;</description>
      <pubDate>Sun, 11 Dec 2022 15:51:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-import-a-helper-module-that-uses-databricks-specific/m-p/32201#M23470</guid>
      <dc:creator>amitca71</dc:creator>
      <dc:date>2022-12-11T15:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to import a helper module that uses databricks specific modules (dbutils)</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-import-a-helper-module-that-uses-databricks-specific/m-p/43019#M27470</link>
      <description>&lt;P&gt;This is a little off topic, but I'm trying to run a PySpark script in VSCode via DataBricks ConnectV2:&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=AP5dGiCU188" target="_blank"&gt;https://www.youtube.com/watch?v=AP5dGiCU188&lt;/A&gt;&lt;BR /&gt;When I do that, I get the error mjbobak describes about dbutils not being defined.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;When I use mjbobak's code or the code Elisabetta shares on SO&amp;nbsp;&lt;BR /&gt;&lt;A href="https://stackoverflow.com/questions/50813493/nameerror-name-dbutils-is-not-defined-in-pyspark" target="_blank"&gt;https://stackoverflow.com/questions/50813493/nameerror-name-dbutils-is-not-defined-in-pyspark&lt;/A&gt;&lt;BR /&gt;the error goes away, but then I get a runtime error:&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;"No operations allowed on this path"&lt;/STRONG&gt;&lt;/FONT&gt; in response to the following dbutils.fs.ls call:&lt;BR /&gt;theFiles = dbutils.fs.ls("/Volumes/myTestData/shawn_test/staging/inbound")&lt;BR /&gt;&lt;BR /&gt;Is there a proper way to define/import dbutils when using Connect V2 to try to debug a PySpark file that is saved locally?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 20:51:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-import-a-helper-module-that-uses-databricks-specific/m-p/43019#M27470</guid>
      <dc:creator>Shawn_Eary</dc:creator>
      <dc:date>2023-08-31T20:51:12Z</dc:date>
    </item>
  </channel>
</rss>

