<?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: Import notebook content into a python file in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/import-notebook-content-into-a-python-file/m-p/52273#M29424</link>
    <description>&lt;P&gt;Found a solution executing a notebook, using the databricks api to download the notebook content as bytes :&lt;/P&gt;&lt;P&gt;1. set environment variables DATABRICKS_HOST and DATABRICKS_TOKEN&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;w = WorkspaceClient()&lt;BR /&gt;with &lt;SPAN&gt;w.workspace.download(notebook_path) &lt;/SPAN&gt;&lt;SPAN&gt;as &lt;/SPAN&gt;&lt;SPAN&gt;n:&lt;BR /&gt;&lt;/SPAN&gt;    notebook_content = n.read()&lt;BR /&gt;exec&lt;SPAN&gt;(notebook_content, &lt;/SPAN&gt;&lt;SPAN&gt;globals&lt;/SPAN&gt;&lt;SPAN&gt;())&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 16 Nov 2023 12:55:35 GMT</pubDate>
    <dc:creator>thibault</dc:creator>
    <dc:date>2023-11-16T12:55:35Z</dc:date>
    <item>
      <title>Import notebook content into a python file</title>
      <link>https://community.databricks.com/t5/data-engineering/import-notebook-content-into-a-python-file/m-p/51607#M29218</link>
      <description>&lt;P&gt;Hi, I have a workflow based on python scripts. How can I import the content of a notebook where a class and functions are defined?&lt;/P&gt;&lt;P&gt;I know how to import python files into notebooks, but the other way around doesn't seem as straight forward.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 14:41:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/import-notebook-content-into-a-python-file/m-p/51607#M29218</guid>
      <dc:creator>thibault</dc:creator>
      <dc:date>2023-11-14T14:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Import notebook content into a python file</title>
      <link>https://community.databricks.com/t5/data-engineering/import-notebook-content-into-a-python-file/m-p/52273#M29424</link>
      <description>&lt;P&gt;Found a solution executing a notebook, using the databricks api to download the notebook content as bytes :&lt;/P&gt;&lt;P&gt;1. set environment variables DATABRICKS_HOST and DATABRICKS_TOKEN&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;w = WorkspaceClient()&lt;BR /&gt;with &lt;SPAN&gt;w.workspace.download(notebook_path) &lt;/SPAN&gt;&lt;SPAN&gt;as &lt;/SPAN&gt;&lt;SPAN&gt;n:&lt;BR /&gt;&lt;/SPAN&gt;    notebook_content = n.read()&lt;BR /&gt;exec&lt;SPAN&gt;(notebook_content, &lt;/SPAN&gt;&lt;SPAN&gt;globals&lt;/SPAN&gt;&lt;SPAN&gt;())&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 16 Nov 2023 12:55:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/import-notebook-content-into-a-python-file/m-p/52273#M29424</guid>
      <dc:creator>thibault</dc:creator>
      <dc:date>2023-11-16T12:55:35Z</dc:date>
    </item>
  </channel>
</rss>

