[英]how to ceate folders in ADLS gen2 by reading a csv file(particular column) stored in adls gen2 in Databrciks
I need help in to ceate folders in ADLS gen2 by reading a csv file(particular column) stored in adls gen2 in Databrciks.我需要帮助通过读取存储在 Databrciks 的 adls gen2 中的 csv 文件(特定列)来创建 ADLS gen2 中的文件夹。 I am able to read csv file but not able to create folders in gen2 using databrciks.
我能够读取 csv 文件,但无法使用 databrciks 在 gen2 中创建文件夹。
I tried reading csv file using account key and SAS token,which i am able to read but not able to craete folders using mount folder in gen2.我尝试使用帐户密钥和 SAS 令牌读取 csv 文件,我能够读取但无法使用 gen2 中的安装文件夹创建文件夹。
Can someone please help on coding part like creating python code to create folders in gen2 using mount point.有人可以帮助编码部分,例如创建 python 代码以使用挂载点在 gen2 中创建文件夹。
dbutils.fs.mount( source = 'path', mount_point = '/mnt/...', extra_configs = {path,accountkey})
To create a directory, you can either use Databricks's dbutils
or use python's os
library.要创建目录,您可以使用 Databricks 的
dbutils
或使用 python 的os
库。
dbutils
in the following way.dbutils
在挂载文件夹中创建目录。dbutils.fs.mkdirs("/mnt/repro/folder1")
os
library and then use os.mkdir
.os
库,然后使用os.mkdir
。import os
os.mkdir("/dbfs/mnt/repro/folder2")
dbutils.fs.ls
.dbutils.fs.ls
检查文件夹是否已创建。dbutils.fs.ls("/mnt/repro")
NOTE: You can also create sub-directories using dbutils
but not with python's os library.注意:您还可以使用
dbutils
创建子目录,但不能使用 python 的 os 库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.