Skip to content

Commit

Permalink
- fixed tests for connections pane
Browse files Browse the repository at this point in the history
- adding better handling of env vars for auth tests
- incremented package version
- updated README table
  • Loading branch information
Zac Davies committed Apr 15, 2024
1 parent 643e263 commit d24d087
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
DATABRICKS_WSID: ${{ secrets.$DATABRICKS_WSID }}

steps:
- uses: actions/checkout@v2
Expand All @@ -31,6 +32,7 @@ jobs:
run: |
echo DATABRICKS_HOST="$DATABRICKS_HOST" >> ~/.Renviron
echo DATABRICKS_TOKEN="$DATABRICKS_TOKEN" >> ~/.Renviron
echo DATABRICKS_WSID="$DATABRICKS_WSID" >> ~/.Renviron
shell: bash

- name: Test coverage
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: brickster
Title: R Toolkit for Databricks
Version: 0.2.0
Version: 0.2.1
Authors@R:
c(
person(given = "Zac",
Expand Down
2 changes: 1 addition & 1 deletion R/connection-pane.R
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ list_objects <- function(host, token,
)

info <- list(
"Data" = "metastore",
"Catalog" = "metastore",
"Model Registry" = "modelregistry",
"Experiments" = "experiments",
"Clusters" = "clusters",
Expand Down
62 changes: 22 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,43 @@
# brickster <a href='https://zacdav-db.github.io/brickster/'><img src='man/figures/logo.png' align="right" height="139" /></a>
# brickster <a href='https://zacdav-db.github.io/brickster/'><img src="man/figures/logo.png" align="right" height="139"/></a>

<!-- badges: start -->
[![R-CMD-check](https://github.com/zacdav-db/brickster/workflows/R-CMD-check/badge.svg)](https://github.com/zacdav-db/brickster/actions)
[![Codecov test
coverage](https://codecov.io/gh/zacdav-db/brickster/branch/main/graph/badge.svg)](https://app.codecov.io/gh/zacdav-db/brickster?branch=main)

[![R-CMD-check](https://github.com/zacdav-db/brickster/workflows/R-CMD-check/badge.svg)](https://github.com/zacdav-db/brickster/actions) [![Codecov test coverage](https://codecov.io/gh/zacdav-db/brickster/branch/main/graph/badge.svg)](https://app.codecov.io/gh/zacdav-db/brickster?branch=main)

<!-- badges: end -->

`{brickster}` aims to reduce friction for R users on Databricks by:

- Providing 1:1 bindings to relevant Databricks API's
- Providing bindings to relevant Databricks API's

- Use Rmarkdown as a Databricks notebook
- Use RMarkdown as a Databricks notebook

- Integrate with RStudio Connections Pane (`open_workspace()`)

- Utility functions to streamline workloads

- Shiny widgets for RStudio

## Installation

`remotes::install_github("zacdav-db/brickster")`

## Setup Authentication

Docs website has [an article](https://zacdav-db.github.io/brickster/articles/setup-auth.html)
that provides details on how to connect to a Databricks workspace.
Docs website has [an article](https://zacdav-db.github.io/brickster/articles/setup-auth.html) that provides details on how to connect to a Databricks workspace.

## API Coverage

| API | Available | Version |
|----------------------------------------------------------------------------------------------------------------------|-----------|---------|
| [DBFS](https://docs.databricks.com/dev-tools/api/latest/dbfs.html) | Yes | 2.0 |
| [Secrets](https://docs.databricks.com/dev-tools/api/latest/secrets.html) | Yes | 2.0 |
| [Repos](https://docs.databricks.com/dev-tools/api/latest/repos.html) | Yes | 2.0 |
| [mlflow Model Registry](https://docs.databricks.com/dev-tools/api/latest/mlflow.html) | Yes | 2.0 |
| [Global Init Scripts](https://docs.databricks.com/dev-tools/api/latest/global-init-scripts.html) | Yes | 2.0 |
| [Clusters](https://docs.databricks.com/dev-tools/api/latest/clusters.html) | Yes | 2.0 |
| [Libraries](https://docs.databricks.com/dev-tools/api/latest/libraries.html) | Yes | 2.0 |
| [Workspace](https://docs.databricks.com/dev-tools/api/latest/workspace.html) | Yes | 2.0 |
| [Endpoints](https://docs.databricks.com/sql/api/sql-endpoints.html) | Yes | 2.0 |
| [Query History](https://docs.databricks.com/sql/api/query-history.html) | Yes | 2.0 |
| [Jobs](https://docs.databricks.com/dev-tools/api/latest/jobs.html) | Yes | 2.1 |
| [REST 1.2 Commands](https://docs.databricks.com/dev-tools/api/1.2/index.html) | Partially | 1.2 |
| [Unity Catalog](https://api-docs.databricks.com/rest/latest/unity-catalog-api-specification-2-1.html) | Partially | 2.1 |
| [Tokens](https://docs.databricks.com/dev-tools/api/latest/tokens.html) | Undecided | 2.0 |
| [Delta Live Tables](https://docs.databricks.com/data-engineering/delta-live-tables/delta-live-tables-api-guide.html) | Undecided | 2.0 |
| mlflow webhooks (Private Preview) | Later | 2.0 |
| [Queries & Dashboards](https://docs.databricks.com/sql/api/queries-dashboards.html) | Undecided | 2.0 |
| [Instance Pools](https://docs.databricks.com/dev-tools/api/latest/instance-pools.html) | Undecided | 2.0 |
| mlflow OSS | Undecided | 2.0 |
| [Cluster Policies](https://docs.databricks.com/dev-tools/api/latest/policies.html) | Never | 2.0 |
| [Permissions](https://docs.databricks.com/dev-tools/api/latest/permissions.html) | Never | 2.0 |
| [Token Management](https://docs.databricks.com/dev-tools/api/latest/token-management.html) | Never | 2.0 |
| [Token](https://docs.databricks.com/dev-tools/api/latest/tokens.html) | Never | 2.0 |
| [SCIM](https://docs.databricks.com/dev-tools/api/latest/scim/index.html) | Never | 2.0 |
| [Account](https://docs.databricks.com/dev-tools/api/latest/account.html) | Never | 2.0 |
| [Groups](https://docs.databricks.com/dev-tools/api/latest/groups.html) | Never | 2.0 |
| [Instance Profiles](https://docs.databricks.com/dev-tools/api/latest/instance-profiles.html) | Never | 2.0 |
| [IP Access List](https://docs.databricks.com/dev-tools/api/latest/ip-access-list.html) | Never | 2.0 |
| API | Available | Version |
|----------------------------------------------------|----------|----------|
| [DBFS](https://docs.databricks.com/dev-tools/api/latest/dbfs.html) | Yes | 2.0 |
| [Secrets](https://docs.databricks.com/dev-tools/api/latest/secrets.html) | Yes | 2.0 |
| [Repos](https://docs.databricks.com/dev-tools/api/latest/repos.html) | Yes | 2.0 |
| [mlflow Model Registry](https://docs.databricks.com/dev-tools/api/latest/mlflow.html) | Yes | 2.0 |
| [Clusters](https://docs.databricks.com/dev-tools/api/latest/clusters.html) | Yes | 2.0 |
| [Libraries](https://docs.databricks.com/dev-tools/api/latest/libraries.html) | Yes | 2.0 |
| [Workspace](https://docs.databricks.com/dev-tools/api/latest/workspace.html) | Yes | 2.0 |
| [Endpoints](https://docs.databricks.com/sql/api/sql-endpoints.html) | Yes | 2.0 |
| [Query History](https://docs.databricks.com/sql/api/query-history.html) | Yes | 2.0 |
| [Jobs](https://docs.databricks.com/dev-tools/api/latest/jobs.html) | Yes | 2.1 |
| [Volumes (Files)](https://docs.databricks.com/api/workspace/files) | Yes | 2.0 |
| [REST 1.2 Commands](https://docs.databricks.com/dev-tools/api/1.2/index.html) | Partially | 1.2 |
| [Unity Catalog](https://api-docs.databricks.com/rest/latest/unity-catalog-api-specification-2-1.html) | Partially | 2.1 |
7 changes: 7 additions & 0 deletions tests/testthat/test-auth.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
existing_host <- Sys.getenv("DATABRICKS_HOST")
existing_token <- Sys.getenv("DATABRICKS_TOKEN")
existing_wsid <- Sys.getenv("DATABRICKS_WSID")

test_that("auth functions - baseline behaviour", {

host <- "some_url"
Expand Down Expand Up @@ -140,3 +144,6 @@ test_that("auth functions - reading .databrickscfg", {

})

Sys.setenv("DATABRICKS_HOST" = existing_host)
Sys.setenv("DATABRICKS_TOKEN" = existing_token)
Sys.setenv("DATABRICKS_WSID" = existing_wsid)
8 changes: 4 additions & 4 deletions tests/testthat/test-connection-pane.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ test_that("Connection Pane Helpers", {
)
model_vers_specific <- get_model_versions(
id = model_id,
version = gsub("(\\d+).*", "\\1", model_vers$name[1]),
version = model_vers$name[1],
host = db_host(),
token = db_token()
)
Expand Down Expand Up @@ -170,7 +170,7 @@ test_that("Connection Pane Helpers", {
lo_tables = list_objects(
metastore = "some_metastore",
catalog = "system",
schema = "access",
schema = "information_schema",
host = db_host(),
token = db_token()
)
Expand All @@ -181,8 +181,8 @@ test_that("Connection Pane Helpers", {
lo_table = list_objects(
metastore = "some_metastore",
catalog = "system",
schema = "access",
table = "audit",
schema = "information_schema",
table = "catalogs",
host = db_host(),
token = db_token()
)
Expand Down

0 comments on commit d24d087

Please sign in to comment.