Skip to content

Conversation

@detule
Copy link
Owner

@detule detule commented Sep 6, 2024

No description provided.

@detule detule force-pushed the feature/independent_column_name_encoding branch from 040f77f to c388e73 Compare September 6, 2024 01:48
detule and others added 14 commits September 10, 2024 10:19
* netezzaSQL: customize odbcDataType

* add missing file

* NEWS: update
* dbConnect: clean up argument checks

* timeout: document NA to mean no timeout

* Update R/dbi-driver.R

Co-authored-by: Simon P. Couch <[email protected]>

* update docs

---------

Co-authored-by: Simon P. Couch <[email protected]>
* netezza: boolean column handling

* try dev dbitest

* Update NEWS.md

Co-authored-by: Simon P. Couch <[email protected]>

---------

Co-authored-by: Simon P. Couch <[email protected]>
…bi#853)

This commit expands the `databricks()` and `snowflake()` helpers to
support the viewer-based OAuth credentials recently introduced in Posit
Connect [0].

It is designed to support writing Shiny apps that take the following
form:

```r
library(shiny)

ui <- fluidPage(textOutput("user"))

server <- function(input, output, session) {
  conn <- reactive({
    pool::dbPool(odbc::snowflake(), session = session)
  })

  output$user <- renderText({
    res <- DBI::dbGetQuery(conn(), "SELECT CURRENT_USER()")
    res[[1]]
  })
}

shinyApp(ui = ui, server = server)
```

Checks for viewer-based credentials are designed to fall back gracefully
to existing authentication methods in some cases. This is intended to
allow users to -- for example -- develop and test a Shiny app that uses
Databricks or Snowflake credentials in desktop RStudio or Posit
Workbench and deploy it with no code changes to Connect.

In addition, making the caller pass a `session` argument (rather than
just detecting, for example, if we're in a Shiny server context) is very
intentional: it makes them express that they *want* viewer-based
credentials, as opposed to using shared credentials for all viewers. It
seems likely to reduce the number of cases where publisher credentials
are used unexpectedly.

Internally we implement the raw HTTP calls to make the token exchange
with Connect to avoid taking a dependency on the `connectapi` package.

Unit tests are included for most of the new error paths, but it's pretty
hard to emulate what Connect is doing here without extensive mocking.

[0]: https://docs.posit.co/connect/user/oauth-integrations/

Signed-off-by: Aaron Jacobs <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants