dbfs_read: Read data from DBFS

View source: R/dbfs_read.R

dbfs_readR Documentation

Read data from DBFS

Description

Return the contents of a file. If the file does not exist, this call throws an exception with RESOURCE_DOES_NOT_EXIST.

Usage

dbfs_read(path, workspace, token = NULL, verbose = T, ...)

Arguments

path

Absolute path to a file on DBFS

workspace

A string representing the web workspace of your Databricks instance. E.g., "https://eastus2.azuredatabricks.net" or "https://demo.cloud.databricks.com".

token

A valid authentication token generated via User Settings in Databricks or via the Databricks REST API 2.0. If none is provided, netrc will be used

verbose

If TRUE, will print the API response to the console. Defaults to FALSE.

...

Additional options to be passed

Details

The API endpoint for reading files from DBFS is '2.0/dbfs/read'. For all details on API calls please see the official documentation at https://docs.databricks.com/dev-tools/api/latest/.

Value

The API response and the base6-encoded contents of the file read.

Examples

# No need to include /dbfs/
file_path <- "/tmp/iris.json"

res <- dbfs_read(path = file_path, workspace = workspace)

data <- res$data

# Decode from base64
tidy_data <- jsonlite::fromJSON(rawToChar(jsonlite::base64_dec(data)))

RafiKurlansik/bricksteR documentation built on Oct. 13, 2022, 6:58 a.m.