r-dbi / odbc

Connect to ODBC databases (using the DBI interface)
https://odbc.r-dbi.org/
Other
387 stars 107 forks source link

correct type checking for `databricks(httpPath)` #787

Closed simonpcouch closed 4 months ago

simonpcouch commented 4 months ago

Closes #786. With this PR:

library(DBI)
library(odbc)

con <-
  dbConnect(
    databricks(),
    httpPath = "/sql/1.0/warehouses/<snip>"
  )

con <-
  dbConnect(
    databricks(),
    HTTPPath = "/sql/1.0/warehouses/<snip>"
  )

con <-
  dbConnect(
    databricks(),
    HTTPPath = 1L
  )
#> Error in `dbConnect()`:
#> ! `HTTPPath` must be a single string or `NULL`, not the number 1.

con <-
  dbConnect(
    databricks(),
    httpPath = "/sql/1.0/warehouses/<snip>",
    HTTPPath = "/sql/1.0/warehouses/<snip>"
  )
#> Error in `dbConnect()`:
#> ! Exactly one of `httpPath` or `HTTPPath` must be supplied.

Created on 2024-04-12 with reprex v2.1.0