<?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: Accessing data bricks data outside data bricks in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/accessing-data-bricks-data-outside-data-bricks/m-p/135530#M4248</link>
    <description>&lt;P&gt;Hi!&lt;BR /&gt;The problem is, I have to authenticate from python code as well with my corporation account. Not copy and paste token to the code.&lt;/P&gt;&lt;P&gt;Any ideas? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Oct 2025 15:18:15 GMT</pubDate>
    <dc:creator>maikel</dc:creator>
    <dc:date>2025-10-21T15:18:15Z</dc:date>
    <item>
      <title>Accessing data bricks data outside data bricks</title>
      <link>https://community.databricks.com/t5/administration-architecture/accessing-data-bricks-data-outside-data-bricks/m-p/135520#M4246</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;What is the best way to access data bricks data, outside data bricks e.g. from Python code? The main problem is authentication so that I can access data to which I have permissions but I would like to generate token outside data bricks (e.g. via REST endpoint).&lt;BR /&gt;The data which I would like to access are files but also tables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will be very thankful for your help and if possible examples how to achieve this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 14:10:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/accessing-data-bricks-data-outside-data-bricks/m-p/135520#M4246</guid>
      <dc:creator>maikel</dc:creator>
      <dc:date>2025-10-21T14:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing data bricks data outside data bricks</title>
      <link>https://community.databricks.com/t5/administration-architecture/accessing-data-bricks-data-outside-data-bricks/m-p/135524#M4247</link>
      <description>&lt;P&gt;Hello Maikel,&lt;/P&gt;&lt;P&gt;You can use your token generated in Databricks and use databricks SQL connector for python.&lt;BR /&gt;More details here:&amp;nbsp;&lt;A href="https://docs.databricks.com/aws/en/dev-tools/python-sql-connector#gsc.tab=0" target="_blank"&gt;Databricks SQL Connector for Python | Databricks on AWS&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 14:35:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/accessing-data-bricks-data-outside-data-bricks/m-p/135524#M4247</guid>
      <dc:creator>Chiran-Gajula</dc:creator>
      <dc:date>2025-10-21T14:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing data bricks data outside data bricks</title>
      <link>https://community.databricks.com/t5/administration-architecture/accessing-data-bricks-data-outside-data-bricks/m-p/135530#M4248</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;The problem is, I have to authenticate from python code as well with my corporation account. Not copy and paste token to the code.&lt;/P&gt;&lt;P&gt;Any ideas? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 15:18:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/accessing-data-bricks-data-outside-data-bricks/m-p/135530#M4248</guid>
      <dc:creator>maikel</dc:creator>
      <dc:date>2025-10-21T15:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing data bricks data outside data bricks</title>
      <link>https://community.databricks.com/t5/administration-architecture/accessing-data-bricks-data-outside-data-bricks/m-p/135540#M4249</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/192995"&gt;@maikel&lt;/a&gt;&amp;nbsp;- You can &lt;A href="https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m?language=Profile" target="_self"&gt;set up&lt;/A&gt; a Service Principal in Databricks and a client ID and Client Secret. Then set up a &lt;A href="https://docs.databricks.com/aws/en/dev-tools/cli/profiles#gsc.tab=0" target="_self"&gt;Databricks profile&lt;/A&gt; and use Python code with that profile. Look at the &lt;A href="https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m?language=Profile#step-2-use-oauth-authorization" target="_self"&gt;profile section&lt;/A&gt; in step 2, how the profile can be set up with client ID and secret for workspace-level operation.&lt;/P&gt;
&lt;P&gt;Databricks uses OAuth 2.0 as the preferred protocol for service principal authorization and authentication outside of the UI. Unified client authentication automates token generation and refresh. When a service principal signs in and is granted consent, OAuth issues an access token for the CLI, SDK, or other tool to use on its behalf. Each access token is valid for one hour, after which a new token is automatically requested.&lt;/P&gt;
&lt;P&gt;Here is my example -&lt;/P&gt;
&lt;P&gt;Profile -&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[fielddemo-sp]
host             = https://workspace.cloud.databricks.com/
client_id        = XXXXXXXXXXXXX
client_secret    = dosedXXXXXXXXXXXXXXXX&lt;/LI-CODE&gt;
&lt;P&gt;Code -&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from databricks.sdk import WorkspaceClient

w = WorkspaceClient(profile="fielddemo-sp")

filepath=f"{w.volumes.read("&amp;lt;&amp;lt;catalog&amp;gt;&amp;gt;.&amp;lt;&amp;lt;schema&amp;gt;&amp;gt;.&amp;lt;&amp;lt;volumename&amp;gt;&amp;gt;").as_dict()['storage_location']}"
print(filepath)
vol_path = "/Volumes/catalog/schema/volumename"
for f in w.files.list_directory_contents(vol_path):
    print(f)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 15:39:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/accessing-data-bricks-data-outside-data-bricks/m-p/135540#M4249</guid>
      <dc:creator>dkushari</dc:creator>
      <dc:date>2025-10-21T15:39:41Z</dc:date>
    </item>
  </channel>
</rss>

