<?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 get the files one by one in blob storage using pyspark/python in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-get-the-files-one-by-one-in-blob-storage-using-pyspark/m-p/83840#M37028</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/115833"&gt;@rameshybr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# List files in a directory
files = dbutils.fs.ls("/mnt/&amp;lt;mount-name&amp;gt;/path/to/directory")

for file in files:
    file_path = file.path
    # Read each file into a DataFrame / if you file format is parquet for example i am taking
    df = spark.read.format("parquet").load(file_path)  
    
    # Perform operations on the DataFrame
    df.show()
    
    df.write.mode("overwrite").parquet("if you want to write to any specific location")
&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 21 Aug 2024 19:01:20 GMT</pubDate>
    <dc:creator>Rishabh-Pandey</dc:creator>
    <dc:date>2024-08-21T19:01:20Z</dc:date>
    <item>
      <title>How to get the files one by one in blob storage using pyspark/python</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-the-files-one-by-one-in-blob-storage-using-pyspark/m-p/83826#M37013</link>
      <description>&lt;P&gt;how to write the pyspark/python to get the files one by one in blob storage.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 15:21:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-the-files-one-by-one-in-blob-storage-using-pyspark/m-p/83826#M37013</guid>
      <dc:creator>rameshybr</dc:creator>
      <dc:date>2024-08-21T15:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the files one by one in blob storage using pyspark/python</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-the-files-one-by-one-in-blob-storage-using-pyspark/m-p/83839#M37027</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/115833"&gt;@rameshybr&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;One way to do that is to get files from a given location using dbutils.fs.ls and then iterate over this list one file after another.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;files = dbutils.fs.ls("abfss://conatiner@account_name.dfs.core.windows.net/folder")

for file in files:
    df = spark.read.json(file.path)
    #implement further logic&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 Aug 2024 18:55:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-the-files-one-by-one-in-blob-storage-using-pyspark/m-p/83839#M37027</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2024-08-21T18:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the files one by one in blob storage using pyspark/python</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-the-files-one-by-one-in-blob-storage-using-pyspark/m-p/83840#M37028</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/115833"&gt;@rameshybr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# List files in a directory
files = dbutils.fs.ls("/mnt/&amp;lt;mount-name&amp;gt;/path/to/directory")

for file in files:
    file_path = file.path
    # Read each file into a DataFrame / if you file format is parquet for example i am taking
    df = spark.read.format("parquet").load(file_path)  
    
    # Perform operations on the DataFrame
    df.show()
    
    df.write.mode("overwrite").parquet("if you want to write to any specific location")
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 Aug 2024 19:01:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-the-files-one-by-one-in-blob-storage-using-pyspark/m-p/83840#M37028</guid>
      <dc:creator>Rishabh-Pandey</dc:creator>
      <dc:date>2024-08-21T19:01:20Z</dc:date>
    </item>
  </channel>
</rss>

