Skip to content

Commit

Permalink
- Adding support for %sh magic command via databricks_sh kntir en…
Browse files Browse the repository at this point in the history
…gine

 - Adding shorthands aliases for kntir engines (`db_{r/py/sh/scala}`)
 - Adjusting DESCRIPTION file
  • Loading branch information
zacdav-db committed Sep 15, 2023
1 parent 3a8b9c1 commit 3042091
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: brickster
Title: R interface to Databricks REST 2.0 APIs
Version: 0.1.1
Version: 0.2.0
Authors@R:
c(
person(given = "Zac",
Expand All @@ -13,7 +13,7 @@ Authors@R:
email = "[email protected]"),
person("Databricks", role = c("cph", "fnd"))
)
Description: R interface to Databricks REST 2.0 APIs.
Description: Toolkit to work with Databricks from R
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Expand Down
10 changes: 9 additions & 1 deletion R/knitr-engines.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ db_engine_scala <- function(options) {
db_engine_template(options, language = "scala")
}


#' Databricks knitr Engine (SQL)
#'
#' @inheritParams db_engine_template
Expand All @@ -58,6 +57,15 @@ db_engine_sql <- function(options) {
db_engine_template(options, language = "sql")
}

#' Databricks knitr Engine (Shell)
#'
#' @inheritParams db_engine_template
#' @noRd
db_engine_sh <- function(options) {
options$code <- paste0("%%sh\n", options$code)
db_engine_template(options, language = "python")
}

#' Clean Command Output From Execution Context
#'
#' @param x Output from [ke_check_command_status()].
Expand Down
8 changes: 7 additions & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
if (requireNamespace("knitr", quietly = TRUE)) {
knitr::knit_engines$set(
databricks_r = db_engine_r,
db_r = db_engine_r,
databricks_py = db_engine_py,
db_py = db_engine_py,
databricks_scala = db_engine_scala,
databricks_sql = db_engine_sql
db_scala = db_engine_scala,
databricks_sql = db_engine_sql,
db_sql = db_engine_sql,
databricks_sh = db_engine_sh,
db_sh = db_engine_sh
)
}
}

0 comments on commit 3042091

Please sign in to comment.