import_to_workspace: Import Code to the Databricks Workspace

View source: R/import_to_workspace.R

import_to_workspaceR Documentation

Import Code to the Databricks Workspace

Description

This function allows you to import .R and .Rmd files into Databricks as an R notebook. This will work whether the files are on your local machine, on DBFS, or from an instance of RStudio that is hosted on a Databricks cluster.

Usage

import_to_workspace(
  file,
  notebook_path,
  workspace,
  token = NULL,
  overwrite = "false",
  verbose = T
)

Arguments

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.

overwrite

Replace an existing notebook? Defaults to 'true', a string.

verbose

If true, will pretty print the success or failure of the request. Defaults to TRUE.

local_file

A string representing the path to a .R or .Rmd file. Generated by create_job or via the Databricks web interface.

Details

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/.

Value

The API response.

Examples

## Import an R script from your local machine to a Notebook on Databricks
import_to_workspace(file = "C:/my_files/my_r_program.R",
                    notebook_path = "/Shared/R/my_r_program",
                    workspace = "https://company.cloud.databricks.com",
                    token = "dapi2130940djvafn98wefasdfjn")



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