使用cmd和R配置数据块

tvmytwxo  于 2023-06-19  发布在  其他
关注(0)|答案(1)|浏览(128)

我正在尝试使用databricks cli并调用databricks configure。这就是我从cmd执行此操作的方式

somepath>databricks configure --token
  Databricks Host (should begin with https://): my_https_address 
  Token: my_token

我想使用R调用相同的命令。于是我就这么做了:

tool.control <- c('databricks configure --token'
                    ,'my_https_address'
                    ,'my_token')

 shell(tool.control)

我得到以下错误

Error in system(command, as.integer(flag), f, stdout, stderr, timeout) : 
  character string expected as first argument

我该如何纠正它?
编辑:在尝试了评论中的建议后,我得到了这个错误:

Databricks Host (should begin with https://): Aborted!
'https:' is not recognized as an internal or external command,
 operable program or batch file.
 'my_token' is not recognized as an internal or external command,
 operable program or batch file.
[[1]]
[1] 1

[[2]]
[1] 1

[[3]]
[1] 1

Warning messages:
 1: In FUN(X[[i]], ...) :
 'databricks configure --token' execution failed with error code 1
 2: In FUN(X[[i]], ...) :
  'my_https_address' execution failed with error code 1
 3: In FUN(X[[i]], ...) :
 'my_token' execution failed with error code 1
oxf4rvwz

oxf4rvwz1#

system {base}的帮助页面说:
这些年来,这个接口变得相当复杂:请参阅System 2,以获得更可移植和更灵活的接口,建议用于新代码。
既然你没有要求我们特别使用shell(),我想你可以使用system 2()(?)
无论如何,遗憾的是我不能让它完全自动化--添加标记作为另一个输入并不奇怪--但这可以让你大部分时间都在那里。
运行第一个命令,然后插入令牌,可以通过复制和粘贴,或者使用Command+Enter(或Control+Enter)让R为您完成,然后按Enter。

system2("databricks", 
        args = "configure --token",
        input = "https://dbc-b6432663c-e88a.cloud.databricks.com") # the URL and token have been changed, these are just made up ones

asfewfwefaewfaefewfee898a98

system2("databricks", args = "workspace list")

"Users
Shared
Repos
spark_mooc_meta" # my workspaces

希望这有帮助!

相关问题