[英]How can we save or upload .py file on dbfs/filestore
在本地需求上,我们很少有.py文件可以存储/保存在dbfs的fileStore路径上。 我该如何实现?
尝试使用dbUtils.fs
模块复制操作。
我尝试了下面的代码,但是没有用,我知道源路径不正确。 还是有更好的方法呢? 请指教
'''
dbUtils.fs.cp ("c:\\file.py", "dbfs/filestore/file.py")
'''
听起来您想将本地文件复制到Azure Databricks服务器的dbfs路径。 但是,由于基于浏览器的Azure Databricks笔记本的交互界面,它无法通过在云上编程直接在本地操作文件。
因此,您可以尝试以下解决方案。
就像@Jon在评论中所说,您可以按照官方文档Databricks CLI
通过Python工具命令pip install databricks-cli
在本地pip install databricks-cli
,然后将文件复制到dbfs 。
按照官方文档“ Accessing Data
将“通过Drop files into or browse to files in the Import & Explore Data box on the landing page
导入数据” Drop files into or browse to files in the Import & Explore Data box on the landing page
,但也建议使用CLI,如下图所示。
将您指定的文件上传到Azure Blob存储,然后按照官方文档Data sources / Azure Blob Storage
进行操作,包括dbutils.fs.cp
。
希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.