8 skiLift: Connect
DBI connections, auth, and identifiers
snowflake, R, RStudio, Posit, VS Code, workspace notebooks, skiPatrol, skiLift, mlops
8.1 Overview
skiLift is the DBI-native way to talk to Snowflake from R over the SQL REST API. Use it for dplyr pipelines, the Connections Pane, parameterized SQL, and optional Arrow/ADBC bulk I/O — without installing JDBC/ODBC or Python.
8.2 Learning Objectives
- Open connections via
connections.toml, JWT, PAT, or Workspace token - Understand auth modes and when to use skiLift vs
sfr_connect() - Configure identifier case for interoperability with other tools
8.3 Installation
In Workspace, install via pre-built tarball in YAML — see Workspace Bootstrap†. Never compile from source in Workspace.
8.4 connections.toml (recommended)
Create ~/.snowflake/connections.toml (shared with Python connector and CLI):
[default]
account = "xy12345.us-east-1"
user = "myuser"
authenticator = "SNOWFLAKE_JWT"
private_key_path = "~/.snowflake/rsa_key.p8"
database = "MY_DB"
schema = "PUBLIC"
warehouse = "MY_WH"
[dev]
account = "xy12345.us-east-1"
user = "myuser"
authenticator = "externalbrowser"
warehouse = "DEV_WH"
database = "DEV_DB"
schema = "ANALYTICS"library(DBI)
library(skiLift)
con <- dbConnect(Snowflake()) # [default]
con <- dbConnect(Snowflake(), name = "dev")
df <- dbGetQuery(con, "SELECT CURRENT_USER(), CURRENT_ROLE()")
dbDisconnect(con)8.5 Programmatic Access Token (PAT)
Create a PAT in Snowsight → Admin → Security → Programmatic Access Tokens. Prefer environment variables over hard-coded tokens:
In Workspace, the managed session OAuth is preferred — reserve PATs for external CI or tools that cannot use the notebook session.
8.6 Workspace (zero config)
After setup_notebook(..., packages=["skiLift"]):
Bootstrap exports variables such as:
SNOWFLAKE_ACCOUNT,SNOWFLAKE_USER,SNOWFLAKE_HOSTSNOWFLAKE_ROLE,SNOWFLAKE_WAREHOUSE,SNOWFLAKE_DATABASE,SNOWFLAKE_SCHEMA(when set)
If dbConnect() fails from a %%R cell, re-run the Python bootstrap cell and confirm you are not mixing laptop connections.toml profiles with the Workspace session.
8.7 Auth modes summary
| Mode | Use case |
|---|---|
| Workspace OAuth | Notebooks (zero config) |
| JWT key-pair | Automation, service users |
| PAT | Personal tokens, CI without key files |
externalbrowser |
Interactive SSO on desktop |
connections.toml |
Local dev parity with Python |
8.8 Identifier case
By default skiLift uppercases unquoted table/column names in DDL/DML — matching Snowflake and ODBC behaviour:
dbWriteTable(con, "my_table", data.frame(id = 1, name = "Alice"))
dbListFields(con, "my_table") # "ID" "NAME"Preserve original case (e.g. lowercase for tidyverse-native pipelines):
dbQuoteIdentifier() always quotes exactly what you pass; the option only affects implicit casing in table operations.
8.9 skiLift vs skiPatrol
| Need | Package |
|---|---|
| ML Registry, Feature Store, doSnowflake | skiPatrol |
| DBI, dbplyr, Connections Pane, SQL-only | skiLift |
| Both in one notebook | sfr_connect() then sfr_dbi_connection(conn) |
skiLift does not require Python. skiPatrol always requires Python + snowflake-ml-python for ML APIs (skiLift may still use reticulate internally for Snowpark bulk writes in Workspace — transparent to the user).
8.10 skiLift vs odbc (Posit / ODBC driver)
For desktop DBI + dbplyr, the other common path is CRAN odbc with Snowflake’s ODBC driver (or Posit-managed driver installs on licensed products). Both expose standard DBI; dplyr code is largely portable.
| skiLift | odbc::snowflake() |
|
|---|---|---|
| Transport | SQL API (+ optional ADBC) | ODBC driver |
| Install | R package | Driver + odbc package |
connections.toml |
dbConnect(Snowflake(), name = ...) |
dbConnect(odbc::snowflake(), connection_name = ...) |
| Workspace | Default — no ODBC install | ODBC only practical if baked into CRE†; not via bootstrap |
In Workspace, ADBC (optional, often in CRE) is the optimized bulk driver path; ODBC was not viable at bootstrap time. Full comparison: RStudio, Posit & VS Code — skiLift vs ODBC.