简体   繁体   English

获取列表中数据湖 gen2 文件夹的所有内容 azure 突触工作区

[英]get all the contents of data lake gen2 folder in a list azure synapse workspace

I am brand new to Azure. I have created a data lake gen2 storage account and a container inside it and saved some files and folders in it.I want to list all the files and folders in azure synapse notebook so that i can process a particular file.我是 Azure 的新手。我在其中创建了一个数据湖 gen2 存储帐户和一个容器,并在其中保存了一些文件和文件夹。我想列出 azure 突触笔记本中的所有文件和文件夹,以便我可以处理特定的文件。 I am using this command我正在使用这个命令

mssparkutils.fs.ls("abfss://iogen2@demoadlsgen2.dfs.core.windows.net/first/")

but it giving me only one output like:但它只给我一个 output,比如:

[FileInfo(path=abfss://iogen2@demoadlsgen2.dfs.core.windows.net/first/stocks, name=stocks, size=0]

I want my answer in a list like:我希望我的答案在如下列表中:

'abfss://iogen2@demoadlsgen2.dfs.core.windows.net/first/stocks/',
'abfss://iogen2@demoadlsgen2.dfs.core.windows.net/first/stocks/2022-03-06/',
'abfss://iogen2@demoadlsgen2.dfs.core.windows.net/first/stocks/2022-03-06/csv_files/',
'abfss://iogen2@demoadlsgen2.dfs.core.windows.net/first/stocks/2022-03-06/csv_files/demo.csv'

Apparently when i am using os.listdir it is giving an error:显然,当我使用 os.listdir 时出现错误:

FileNotFoundError: [Errno 2] No such file or directory:

Can anyone please help me in this谁能帮我解决这个问题

As per the repro from my end, it shows all the files in the folder.根据我的复制,它显示了文件夹中的所有文件。

Here is files contained in the folder named sample:以下是名为 sample 的文件夹中包含的文件:

在此处输入图像描述

I'm able to get the all the files contained in the folder named sample:我能够获取名为 sample 的文件夹中包含的所有文件:

在此处输入图像描述

If you want to use the os.listdir you need to use file mount/unmount API in Synapse .如果要使用os.listdir ,则需要在 Synapse 中使用文件 mount/unmount API

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 Databricks /mnt 安装 Azure Data lake Gen2 - Mounting Azure Data lake Gen2 with Databricks /mnt 将数据从本地 sql 服务器复制到 Azure Data Lake Storage Gen2 中的增量格式 - copy data from on premise sql server to delta format in Azure Data Lake Storage Gen2 用于解析 Azure Data Lake Storage Gen2 URI 的正则表达式,用于使用 Azurite 进行生产和测试 - Regex to parse Azure Data Lake Storage Gen2 URI for production and testing with Azurite Azure Data Lake Gen2 存储帐户 blob 与 adf 选择 - Azure Data Lake Gen2 Storage Account blob vs adf choice 如何使用 dbt 将镶木地板文件从 Azure Data Lake Gen2/Azure Blob 存储加载到专用池? - How to load parquet files from Azure Data Lake Gen2/Azure Blob Storage to Dedicated pool using dbt? 无法使用 python azure-storage-file-datalake SDK 在 Azure Data Lake Gen2 中创建 Append Blob - Cannot create Append Blobs in Azure Data Lake Gen2 using python azure-storage-file-datalake SDK Databricks、dbutils、获取 Azure Data Lake gen 2 路径中所有子文件夹的文件计数和文件大小 - Databricks, dbutils, get filecount and filesize of all subfolders in Azure Data Lake gen 2 path Dataverse 到 Synapse 链接 - Workspace 中缺少 Lake 数据库 - Dataverse to Synapse Link - missing Lake database in Workspace ADLS Gen2 --> 文件夹级别的 ACL - ADLS Gen2 --> ACL on a folder level Azure Synapse中Delta Lake和Lake Database的区别 - Difference between Delta Lake and Lake Database in Azure Synapse
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM