无法将文件从DBFS复制到Databricks中的本地桌面 [英] Not able to copy file from DBFS to local desktop in Databricks

查看:144
本文介绍了无法将文件从DBFS复制到Databricks中的本地桌面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将文件从dbfs保存或复制到我的桌面(本地)。我使用此命令,但出现错误:

I want to save or copy my file from the dbfs to my desktop (local). I use this command but get an error:

dbutils.fs.cp('/dbfs/username/test.txt', 'C:\Users\username\Desktop') 
Error: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

当我为自己的案例查询dbutils.fs.help()时,我遵循了以下说明:

When I lookup the dbutils.fs.help() for my case, I followed the instructions:

dbutils.fs provides utilities for working with FileSystems. Most methods in this package can take either a DBFS path (e.g., "/foo" or "dbfs:/foo"), or another FileSystem URI. For more info about a method, use dbutils.fs.help("methodName"). In notebooks, you can also use the %fs shorthand to access DBFS. The %fs shorthand maps straightforwardly onto dbutils calls. For example, "%fs head --maxBytes=10000 /file/path" translates into "dbutils.fs.head("/file/path", maxBytes = 10000)".

fsutils
cp(from: String, to: String, recurse: boolean = false): boolean -> Copies a file or directory, possibly across FileSystems


推荐答案

使用Databricks CLI执行此任务。

You need to use the Databricks CLI for this task.

在本地计算机上安装CLI并运行 databricks configure 进行身份验证。使用在用户设置下生成的访问令牌作为密码。

Install the CLI on your local machine and run databricks configure to authenticate. Use an access token generated under user settings as the password.

一旦已安装CLI并将其配置到工作区,就可以像这样在DBFS之间复制文件:

Once you have the CLI installed and configured to your workspace, you can copy files to and from DBFS like this:

databricks fs cp dbfs:/ path_to_file / my_file / path_to_local_file / my_file

您也可以使用简写

dbfs cp db dbfs:/ path_to_file / path_to_local_file

这篇关于无法将文件从DBFS复制到Databricks中的本地桌面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆