<?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: Compile all the scripts under  the workspace folder in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32677#M23817</link>
    <description>&lt;P&gt;Problem is that you can list all files in workspace only via API call and than you can run every one of them using:&lt;/P&gt;&lt;P&gt;dbutils.notebook.run()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the script to list files from workspace (probably you need to add some filterning):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import requests
ctx = dbutils.notebook.entry_point.getDbutils().notebook().getContext()
host_name = ctx.tags().get("browserHostName").get()
host_token = ctx.apiToken().get()
&amp;nbsp;
response = requests.post(
    f'https://{host_name}/api/2.0/workspace/list',
    headers={'Authorization': f'Bearer {host_token}'},
    data = {'path': '&amp;lt;your-path&amp;gt;'}
  ).json()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Dec 2021 14:58:14 GMT</pubDate>
    <dc:creator>Hubert-Dudek</dc:creator>
    <dc:date>2021-12-22T14:58:14Z</dc:date>
    <item>
      <title>Compile all the scripts under  the workspace folder</title>
      <link>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32675#M23815</link>
      <description>&lt;P&gt;In workspace one folder I have around 100+ pyspark scripts, all these scripts need to be compiled before running the main program. In order to compile all these files, we are using the %run magic command like &lt;B&gt;%run ../prod/netSales&lt;/B&gt;. Since we have 100+ such files, we wrote 100+ magic commands like in a notebook to compile all 100+ files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question is, is there any way to compile all the files under one folder in ADB workspace instead of one by one? Are there any iterative methods are available to go through eah the file and compile it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 11:55:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32675#M23815</guid>
      <dc:creator>thushar</dc:creator>
      <dc:date>2021-12-22T11:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Compile all the scripts under  the workspace folder</title>
      <link>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32677#M23817</link>
      <description>&lt;P&gt;Problem is that you can list all files in workspace only via API call and than you can run every one of them using:&lt;/P&gt;&lt;P&gt;dbutils.notebook.run()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the script to list files from workspace (probably you need to add some filterning):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import requests
ctx = dbutils.notebook.entry_point.getDbutils().notebook().getContext()
host_name = ctx.tags().get("browserHostName").get()
host_token = ctx.apiToken().get()
&amp;nbsp;
response = requests.post(
    f'https://{host_name}/api/2.0/workspace/list',
    headers={'Authorization': f'Bearer {host_token}'},
    data = {'path': '&amp;lt;your-path&amp;gt;'}
  ).json()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 14:58:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32677#M23817</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2021-12-22T14:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compile all the scripts under  the workspace folder</title>
      <link>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32678#M23818</link>
      <description>&lt;P&gt;When I tried the above code I got the below error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{'error_code': 'ENDPOINT_NOT_FOUND', 'message': "No API found for 'POST /workspace/list'"}&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 07:01:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32678#M23818</guid>
      <dc:creator>thushar</dc:creator>
      <dc:date>2021-12-23T07:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Compile all the scripts under  the workspace folder</title>
      <link>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32679#M23819</link>
      <description>&lt;P&gt;what distribution are you using (community, Azure)? so I will update that code as it is quite old&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 13:10:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32679#M23819</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2021-12-23T13:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Compile all the scripts under  the workspace folder</title>
      <link>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32680#M23820</link>
      <description>&lt;P&gt;I didn't get you correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using 9.1 LTS run time, ADB premium service, DS3_V2 instance... is it will help?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 13:19:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32680#M23820</guid>
      <dc:creator>thushar</dc:creator>
      <dc:date>2021-12-23T13:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Compile all the scripts under  the workspace folder</title>
      <link>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32681#M23821</link>
      <description>&lt;P&gt;so Azure - just tested , had to change to get and data to json. Please manipulate with path to get data from folder which you need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import requests
ctx = dbutils.notebook.entry_point.getDbutils().notebook().getContext()
host_name = ctx.tags().get("browserHostName").get()
host_token = ctx.apiToken().get()
&amp;nbsp;
response = requests.get(
    f'https://{host_name}/api/2.0/workspace/list',
    headers={'Authorization': f'Bearer {host_token}',
            'Accept': 'application/json'},
    json = {'path': '/'}
  )&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 13:48:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32681#M23821</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2021-12-23T13:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Compile all the scripts under  the workspace folder</title>
      <link>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32682#M23822</link>
      <description>&lt;P&gt;did it help?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Dec 2021 11:00:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32682#M23822</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2021-12-24T11:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Compile all the scripts under  the workspace folder</title>
      <link>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32683#M23823</link>
      <description>&lt;P&gt;Sorry for the delay, that was not completely fixed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modified the code which you shared, and now I could able to get the list of files under the folder in the workspace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to compile (not to run) the files, is there any way there? Can we use magic command %run in some loop or something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 10:38:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32683#M23823</guid>
      <dc:creator>thushar</dc:creator>
      <dc:date>2022-01-21T10:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Compile all the scripts under  the workspace folder</title>
      <link>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32684#M23824</link>
      <description>&lt;P&gt;@Thushar R​&amp;nbsp; does &lt;A href="https://docs.databricks.com/notebooks/notebook-workflows.html" target="test_blank"&gt;https://docs.databricks.com/notebooks/notebook-workflows.html&lt;/A&gt; notebook workflow help you on this scenario ?&lt;/P&gt;</description>
      <pubDate>Sat, 12 Feb 2022 16:20:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/compile-all-the-scripts-under-the-workspace-folder/m-p/32684#M23824</guid>
      <dc:creator>Atanu</dc:creator>
      <dc:date>2022-02-12T16:20:34Z</dc:date>
    </item>
  </channel>
</rss>

