11# Databricks DBFS API
2- # https://docs.databricks.com/dev-tools/api/latest/dbfs.html
32
43# ' DBFS Create
54# '
2726# ' @return Handle which should subsequently be passed into [db_dbfs_add_block()]
2827# ' and [db_dbfs_close()] when writing to a file through a stream.
2928# ' @export
30- db_dbfs_create <- function (path , overwrite = FALSE ,
31- host = db_host(), token = db_token(),
32- perform_request = TRUE ) {
29+ db_dbfs_create <- function (
30+ path ,
31+ overwrite = FALSE ,
32+ host = db_host(),
33+ token = db_token(),
34+ perform_request = TRUE
35+ ) {
3336 body <- list (
3437 path = path ,
3538 overwrite = overwrite
@@ -51,7 +54,6 @@ db_dbfs_create <- function(path, overwrite = FALSE,
5154 } else {
5255 req
5356 }
54-
5557}
5658
5759
@@ -80,10 +82,14 @@ db_dbfs_create <- function(path, overwrite = FALSE,
8082# ' @export
8183# ' @importFrom stats setNames
8284# ' @importFrom utils object.size
83- db_dbfs_add_block <- function (handle , data , convert_to_raw = FALSE ,
84- host = db_host(), token = db_token(),
85- perform_request = TRUE ) {
86-
85+ db_dbfs_add_block <- function (
86+ handle ,
87+ data ,
88+ convert_to_raw = FALSE ,
89+ host = db_host(),
90+ token = db_token(),
91+ perform_request = TRUE
92+ ) {
8793 # `base64enc::base64encode()` can't accept strings
8894 # if `convert_to_raw` is TRUE then convert so that the string is encoded
8995 # otherwise it will assume it's a file path on the local system
@@ -127,7 +133,6 @@ db_dbfs_add_block <- function(handle, data, convert_to_raw = FALSE,
127133 } else {
128134 req
129135 }
130-
131136}
132137
133138
@@ -149,10 +154,12 @@ db_dbfs_add_block <- function(handle, data, convert_to_raw = FALSE,
149154# '
150155# ' @return HTTP Response
151156# ' @export
152- db_dbfs_close <- function (handle ,
153- host = db_host(), token = db_token(),
154- perform_request = TRUE ) {
155-
157+ db_dbfs_close <- function (
158+ handle ,
159+ host = db_host(),
160+ token = db_token(),
161+ perform_request = TRUE
162+ ) {
156163 body <- list (handle = handle )
157164
158165 req <- db_request(
@@ -169,7 +176,6 @@ db_dbfs_close <- function(handle,
169176 } else {
170177 req
171178 }
172-
173179}
174180
175181
@@ -188,10 +194,12 @@ db_dbfs_close <- function(handle,
188194# ' @family DBFS API
189195# '
190196# ' @export
191- db_dbfs_get_status <- function (path ,
192- host = db_host(), token = db_token(),
193- perform_request = TRUE ) {
194-
197+ db_dbfs_get_status <- function (
198+ path ,
199+ host = db_host(),
200+ token = db_token(),
201+ perform_request = TRUE
202+ ) {
195203 body <- list (path = path )
196204
197205 req <- db_request(
@@ -208,7 +216,6 @@ db_dbfs_get_status <- function(path,
208216 } else {
209217 req
210218 }
211-
212219}
213220
214221# ' DBFS List
@@ -237,10 +244,12 @@ db_dbfs_get_status <- function(path,
237244# '
238245# ' @return data.frame
239246# ' @export
240- db_dbfs_list <- function (path ,
241- host = db_host(), token = db_token(),
242- perform_request = TRUE ) {
243-
247+ db_dbfs_list <- function (
248+ path ,
249+ host = db_host(),
250+ token = db_token(),
251+ perform_request = TRUE
252+ ) {
244253 body <- list (path = path )
245254
246255 req <- db_request(
@@ -257,7 +266,6 @@ db_dbfs_list <- function(path,
257266 } else {
258267 req
259268 }
260-
261269}
262270
263271# ' DBFS mkdirs
@@ -278,10 +286,12 @@ db_dbfs_list <- function(path,
278286# ' @family DBFS API
279287# '
280288# ' @export
281- db_dbfs_mkdirs <- function (path ,
282- host = db_host(), token = db_token(),
283- perform_request = TRUE ) {
284-
289+ db_dbfs_mkdirs <- function (
290+ path ,
291+ host = db_host(),
292+ token = db_token(),
293+ perform_request = TRUE
294+ ) {
285295 body <- list (
286296 path = path
287297 )
@@ -300,7 +310,6 @@ db_dbfs_mkdirs <- function(path,
300310 } else {
301311 req
302312 }
303-
304313}
305314
306315# ' DBFS Move
@@ -335,10 +344,13 @@ db_dbfs_mkdirs <- function(path,
335344# ' @family DBFS API
336345# '
337346# ' @export
338- db_dbfs_move <- function (source_path , destination_path ,
339- host = db_host(), token = db_token(),
340- perform_request = TRUE ) {
341-
347+ db_dbfs_move <- function (
348+ source_path ,
349+ destination_path ,
350+ host = db_host(),
351+ token = db_token(),
352+ perform_request = TRUE
353+ ) {
342354 body <- list (
343355 source_path = source_path ,
344356 destination_path = destination_path
@@ -358,7 +370,6 @@ db_dbfs_move <- function(source_path, destination_path,
358370 } else {
359371 req
360372 }
361-
362373}
363374
364375# ' DBFS Delete
@@ -372,10 +383,13 @@ db_dbfs_move <- function(source_path, destination_path,
372383# ' @family DBFS API
373384# '
374385# ' @export
375- db_dbfs_delete <- function (path , recursive = FALSE ,
376- host = db_host(), token = db_token(),
377- perform_request = TRUE ) {
378-
386+ db_dbfs_delete <- function (
387+ path ,
388+ recursive = FALSE ,
389+ host = db_host(),
390+ token = db_token(),
391+ perform_request = TRUE
392+ ) {
379393 body <- list (
380394 path = path ,
381395 recursive = recursive
@@ -395,7 +409,6 @@ db_dbfs_delete <- function(path, recursive = FALSE,
395409 } else {
396410 req
397411 }
398-
399412}
400413
401414# ' DBFS Put
@@ -423,10 +436,15 @@ db_dbfs_delete <- function(path, recursive = FALSE,
423436# ' @family DBFS API
424437# '
425438# ' @export
426- db_dbfs_put <- function (path , file = NULL , contents = NULL , overwrite = FALSE ,
427- host = db_host(), token = db_token(),
428- perform_request = TRUE ) {
429-
439+ db_dbfs_put <- function (
440+ path ,
441+ file = NULL ,
442+ contents = NULL ,
443+ overwrite = FALSE ,
444+ host = db_host(),
445+ token = db_token(),
446+ perform_request = TRUE
447+ ) {
430448 body <- list (
431449 path = path ,
432450 overwrite = from_logical(overwrite )
@@ -462,7 +480,6 @@ db_dbfs_put <- function(path, file = NULL, contents = NULL, overwrite = FALSE,
462480 } else {
463481 req
464482 }
465-
466483}
467484
468485
@@ -491,9 +508,14 @@ db_dbfs_put <- function(path, file = NULL, contents = NULL, overwrite = FALSE,
491508# ' @family DBFS API
492509# '
493510# ' @export
494- db_dbfs_read <- function (path , offset = 0 , length = NULL ,
495- host = db_host(), token = db_token(),
496- perform_request = TRUE ) {
511+ db_dbfs_read <- function (
512+ path ,
513+ offset = 0 ,
514+ length = NULL ,
515+ host = db_host(),
516+ token = db_token(),
517+ perform_request = TRUE
518+ ) {
497519 body <- list (
498520 path = path ,
499521 offset = offset ,
@@ -514,5 +536,4 @@ db_dbfs_read <- function(path, offset = 0, length = NULL,
514536 } else {
515537 req
516538 }
517-
518539}
0 commit comments