如何将 html 文件从 azure synapse 笔记本保存到 Datalake 存储?

问题描述 投票:0回答:1

在 Azure Synapse 和 Pyspark 中,我正在使用 ProfileReport 进行数据分析 (https://github.com/ydataai/ydata-profiling):

report = ProfileReport(dataframe
                title="Profiling_pyspark_DataFrame",
                infer_dtypes=False,
                interactions=None,
                missing_diagrams=None,
                correlations={"auto": {"calculate": False},
                              "pearson": {"calculate": False},
                              "spearman": {"calculate": False}})

当我在笔记本单元格上调用报告变量时,我看到了要保存在 ADLS 上的 HTML 内容。

现在我尝试使用以下方法将 HTML 保存在数据湖中:

report.to_file("abfss://[email protected]/profile.html")

但是我有错误:

FileNotFoundError: [Errno 2] No such file or directory: 'abfss:/[email protected]/profile.html'

我哪里错了? (我在突触和 ADLS 之间有链接服务)。

pyspark azure-synapse azure-data-lake
1个回答
0
投票

是的,你说得对。我只是添加它以通过其他方式回答,以便对社区有所帮助。

mssparkutils.fs.put("abfss://[email protected]/synapse/report.html", profile.to_html(), True)

输出:

Enter image description here

另一种方法是将其保存在 Synapse 中并复制或移动到 ADLS 存储。

profile.to_file("/tmp/report2.html")
mssparkutils.fs.cp("file:/tmp/report2.html", "abfss://d[email protected]/synapse/report2.html")

mssparkutils.fs.mv("file:/tmp/report2.html", "abfss://d[email protected]/synapse/report3.html")

输出:

Enter image description here

在 Synapse 中访问本地文件系统时,需要在路径前加上

file:/
前缀。

© www.soinside.com 2019 - 2024. All rights reserved.