<?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 Import warnings when running DBT as a package on Databricks 13.3LTS in Warehousing &amp; Analytics</title>
    <link>https://community.databricks.com/t5/warehousing-analytics/import-warnings-when-running-dbt-as-a-package-on-databricks-13/m-p/52308#M1053</link>
    <description>&lt;P&gt;Executing dbt as a Python package triggers about 200 import warnings when ran on Databricks Runtime 13.3 but not on 12.2. The warnings are all the same:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&amp;lt;frozen importlib._bootstrap&amp;gt;:914: ImportWarning: ImportHookFinder.find_spec() not found; falling back to find_module()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The warning does &lt;STRONG&gt;NOT&lt;/STRONG&gt; popup when running the same python code locally either!&lt;BR /&gt;The warning also appear when installing dbt-core instead of dbt-databricks but since it only happens when running on Databricks clusters, I think it makes sense to post it here.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Since this 'Find_spec' warning is introduced in python 3.10, this explain why it doesn't show up on 12.2 but it does happen on 13.3.&lt;/SPAN&gt;&lt;/P&gt;&lt;H3&gt;Steps To Reproduce&lt;/H3&gt;&lt;P&gt;Add a python file to your Databricks workspace and add this code. Run it on a Databricks cluster with 13.3LTS runtime (Shared or Single) and pre-install dbt-core 1.7.1 or dbt-databricks 1.7.1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;print("Starting")

from dbt.cli.main import dbtRunner

dbt = dbtRunner()

print("The End")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you want to run the script a second time, you first need to 'detach &amp;amp; attach' otherwise the warnings won't show up.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;As a workaround, I tried suppressing the warnings using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;warnings.filterwarnings(action="ignore", category=ImportWarning)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;but this doesn't work. I can set the action to error (which does raise the warnings to exception) and capture it in a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;try...except&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;but than the package is not imported (correctly).&lt;/P&gt;&lt;P&gt;So my question is: how to I get rid of these warnings?&lt;/P&gt;&lt;H3&gt;Additional info&lt;/H3&gt;&lt;P&gt;The original message come from this issue in dbt:&amp;nbsp;&lt;A href="https://github.com/dbt-labs/dbt-core/issues/7828" target="_blank" rel="noopener"&gt;[CT-2672] [Bug] Cannot import name 'Unpack' from 'typing_extensions' (dbt-core 1.5.1) · Issue #7828 · dbt-labs/dbt-core (github.com)&lt;/A&gt;. In one of the last remarks in this thread, tlento from dbt concludes that it probably has to with the way the databricks runtime installs/clobbers its packages. That why I posted this here. Maybe there is a way to ensure the dbt package is installed after dbx runtime installed all of its packages?&lt;/P&gt;&lt;P&gt;I also posted the same thing in the dbt-databricks repo here:&amp;nbsp;&lt;A href="https://github.com/databricks/dbt-databricks/issues/497" target="_blank" rel="noopener"&gt;Import warnings when running DBT as a package on Databricks 13.3LTS · Issue #497 · databricks/dbt-databricks (github.com)&lt;/A&gt;. But unfortunately it got closed without looking into it.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Nov 2023 15:05:54 GMT</pubDate>
    <dc:creator>nijhuist</dc:creator>
    <dc:date>2023-11-16T15:05:54Z</dc:date>
    <item>
      <title>Import warnings when running DBT as a package on Databricks 13.3LTS</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/import-warnings-when-running-dbt-as-a-package-on-databricks-13/m-p/52308#M1053</link>
      <description>&lt;P&gt;Executing dbt as a Python package triggers about 200 import warnings when ran on Databricks Runtime 13.3 but not on 12.2. The warnings are all the same:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&amp;lt;frozen importlib._bootstrap&amp;gt;:914: ImportWarning: ImportHookFinder.find_spec() not found; falling back to find_module()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The warning does &lt;STRONG&gt;NOT&lt;/STRONG&gt; popup when running the same python code locally either!&lt;BR /&gt;The warning also appear when installing dbt-core instead of dbt-databricks but since it only happens when running on Databricks clusters, I think it makes sense to post it here.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Since this 'Find_spec' warning is introduced in python 3.10, this explain why it doesn't show up on 12.2 but it does happen on 13.3.&lt;/SPAN&gt;&lt;/P&gt;&lt;H3&gt;Steps To Reproduce&lt;/H3&gt;&lt;P&gt;Add a python file to your Databricks workspace and add this code. Run it on a Databricks cluster with 13.3LTS runtime (Shared or Single) and pre-install dbt-core 1.7.1 or dbt-databricks 1.7.1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;print("Starting")

from dbt.cli.main import dbtRunner

dbt = dbtRunner()

print("The End")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you want to run the script a second time, you first need to 'detach &amp;amp; attach' otherwise the warnings won't show up.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;As a workaround, I tried suppressing the warnings using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;warnings.filterwarnings(action="ignore", category=ImportWarning)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;but this doesn't work. I can set the action to error (which does raise the warnings to exception) and capture it in a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;try...except&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;but than the package is not imported (correctly).&lt;/P&gt;&lt;P&gt;So my question is: how to I get rid of these warnings?&lt;/P&gt;&lt;H3&gt;Additional info&lt;/H3&gt;&lt;P&gt;The original message come from this issue in dbt:&amp;nbsp;&lt;A href="https://github.com/dbt-labs/dbt-core/issues/7828" target="_blank" rel="noopener"&gt;[CT-2672] [Bug] Cannot import name 'Unpack' from 'typing_extensions' (dbt-core 1.5.1) · Issue #7828 · dbt-labs/dbt-core (github.com)&lt;/A&gt;. In one of the last remarks in this thread, tlento from dbt concludes that it probably has to with the way the databricks runtime installs/clobbers its packages. That why I posted this here. Maybe there is a way to ensure the dbt package is installed after dbx runtime installed all of its packages?&lt;/P&gt;&lt;P&gt;I also posted the same thing in the dbt-databricks repo here:&amp;nbsp;&lt;A href="https://github.com/databricks/dbt-databricks/issues/497" target="_blank" rel="noopener"&gt;Import warnings when running DBT as a package on Databricks 13.3LTS · Issue #497 · databricks/dbt-databricks (github.com)&lt;/A&gt;. But unfortunately it got closed without looking into it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2023 15:05:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/import-warnings-when-running-dbt-as-a-package-on-databricks-13/m-p/52308#M1053</guid>
      <dc:creator>nijhuist</dc:creator>
      <dc:date>2023-11-16T15:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Import warnings when running DBT as a package on Databricks 13.3LTS</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/import-warnings-when-running-dbt-as-a-package-on-databricks-13/m-p/54079#M1083</link>
      <description>&lt;P&gt;Hi Kaniz,&lt;/P&gt;&lt;P&gt;Thanks for your reply!&lt;/P&gt;&lt;P&gt;I have tested this with Runtime 13.1, 13.3 (LTS),&amp;nbsp; 13.3 (LTS) ML, 14.0, 14.1 and 14.2. All with the same result.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;With 'notebook-scoped library installation' you mean doing something like this in the first cell, right?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;%pip install dbt-databricks==1.7.1&lt;/LI-CODE&gt;&lt;P&gt;I had to add a second cell with this to prevent an error:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;dbutils.library.restartPython()&lt;/LI-CODE&gt;&lt;P&gt;This second cell solved the error but the warnings are still there. Without the second cell I got the warnings as well by the way but than it ended with an import error.&lt;/P&gt;&lt;P&gt;I also tried adding the '--ignore-installed' flag to pip install but got the same result.&lt;/P&gt;&lt;P&gt;Is this what you meant by&amp;nbsp;'notebook-scoped library installation' or is there some other approach I could try?&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;&lt;SPAN&gt;Thijs&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2023 08:58:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/import-warnings-when-running-dbt-as-a-package-on-databricks-13/m-p/54079#M1083</guid>
      <dc:creator>nijhuist</dc:creator>
      <dc:date>2023-11-28T08:58:55Z</dc:date>
    </item>
  </channel>
</rss>

