Share via

how to ceate folders in ADLS gen2 by reading a csv file(particular column) stored in adls gen2 in Databrciks.

Smruti Prava Sahu 1 Reputation point
2022-12-19T07:35:26.137+00:00

how to ceate folders in ADLS gen2 by reading a csv file(particular column) stored in adls gen2 in Databrciks.

I am able to read csv file from gen2 using account key and sas token but not able to create folders in gen2 accordingly.

Azure Data Lake Storage
Azure Data Lake Storage

An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.

Azure Databricks
Azure Databricks

An Apache Spark-based analytics platform optimized for Azure.

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bhargava-MSFT 31,361 Reputation points Microsoft Employee Moderator
    2022-12-19T20:11:24.69+00:00

    Hello @Smruti Prava Sahu ,

    Welcome to the MS Q&A platform.

    You can use dbutils to create the folders in gen2

    You will need to mount the storage first and then create folders using dbutils.fs.mkdirs

    dbutils.fs.mount( source = 'wasbs://<containername>@<gen2>.blob.core.windows.net/', mount_point = '/mnt/yourpath', extra_configs = {'fs.azure.account.key.<gen2>.blob.core.windows.net':'Accountkey'})  
      
    dbutils.fs.mkdirs("/mnt/<mountName>path/folderName")  
      (or)  
    dbutils.fs.mkdirs("dbfs:/mnt/<mountName>path/folderName")  
    

    I hope this helps. Please let me know if you have any further questions.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.