export_from_workspace: Export a Notebook or Directory from a Databricks Workspace

View source: R/export_from_workspace.R

export_from_workspaceR Documentation

Export a Notebook or Directory from a Databricks Workspace

Description

Export a notebook or contents of an entire directory. If path does not exist, this call returns an error RESOURCE_DOES_NOT_EXIST. You can export a directory only in DBC format. If the exported data exceeds the size limit, this call returns an error MAX_NOTEBOOK_SIZE_EXCEEDED. This API does not support exporting a library. The API endpoint for importing files to the workspace is '2.0/workspace/import'. For all details on API calls please see the official documentation at https://docs.databricks.com/dev-tools/api/latest/.

Usage

export_from_workspace(
  workspace_path,
  format,
  direct_download = "true",
  filename = NULL,
  workspace,
  token = NULL,
  verbose = T
)

Arguments

workspace_path

A string representing the path to notebook or folder in the Databricks workspace.

format

A string. This specifies the format of the exported file. By default, this is SOURCE. However it may be one of: SOURCE, HTML, JUPYTER, DBC. The value is case sensitive.

direct_download

A string. Flag to enable direct download. If 'true', the response will be the exported file itself. Otherwise, the response contains content as base64 encoded string. Defaults to 'true'.

filename

Optional string representing the path to save the file locally.

workspace

A string representing the web workspace of your Databricks instance. E.g., "https://eastus2.azuredatabricks.net" or "https://company.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 pretty print the success or failure of the request. Defaults to TRUE.

Value

The API response. If filename is provided, will write the file to disk.

Examples

# Export a notebook as HTML
export_from_workspace(workspace_path = "/Shared/R_Notebook",
                      format = "HTML",
                      filename = "/Desktop/r_notebook.html",
                      direct_download = 'true',
                      workspace = workspace,
                      token = token)

# Export a directory as DBC
export_from_workspace(workspace_path = "/Shared/",
                      format = "DBC",
                      filename = "/Desktop/shared.dbc",
                      direct_download = 'true',
                      workspace = workspace,
                      token = token)

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