RSnowflake in Snowflake Workspace Notebooks

This vignette focuses on Snowflake Workspace Notebooks: how RSnowflake fits the Python + %%R model, what to install first, and how ADBC (adbcsnowflake) behaves behind the internal SPCS gateway. For general DBI usage and authentication modes, see vignette("getting-started", package = "RSnowflake").

Execution model

  1. The Python kernel holds the Snowpark session Workspace creates for you.
  2. %%R cells run R via rpy2; RSnowflake in R uses HTTPS like anywhere else.
  3. dbConnect(Snowflake()) in R succeeds when the environment variables Workspace / setup_notebook() export are present (see the getting-started vignette, Snowflake Workspace Notebooks section).

Run your Python bootstrap (for example setup_notebook() from sfnb_setup.py) before the first %%R cell that loads RSnowflake.

Optional ADBC (adbcsnowflake)

ADBC is optional. When adbcsnowflake and adbcdrivermanager are installed, RSnowflake can use Arrow-native paths for reads and bulk writes. Building adbcsnowflake requires a Go compiler on the machine where install.packages() runs.

In Workspace, install tooling from the Python / micromamba side so PATH and compilers are consistent. Do not rely on a minimal PATH inside a bare %%R cell to find Go: follow the bootstrap script for your stack (many teams use sfnb-multilang with an --adbc or equivalent preset).

External Access Integration (EAI) must allow every HTTP redirect needed to download R packages and Go modules (for example R-universe / CDN and proxy.golang.org / storage.googleapis.com). Your Snowflake admin can compare hosts against network-rule documentation for the snowflake-notebook-multilang toolkit.

Internal SPCS gateway (SNOWFLAKE_HOST)

From Workspace containers, RSnowflake and ADBC can use the internal gateway (SNOWFLAKE_HOST) with the container OAuth token. You do not need the public *.snowflakecomputing.com URL for routine Snowflake traffic when the session is wired correctly.

Bulk write routing (upload_method = "auto", thresholds, fallbacks) is described in vignette("getting-started", package = "RSnowflake") (Bulk Write Methods). Tuning options use R options such as RSnowflake.upload_method and RSnowflake.bulk_write_threshold.

Deep dive and benchmarks

The authoritative engineering note for Workspace + ADBC (architecture, redirect chains, benchmarks, PAT fallbacks for external hosts) ships in the RSnowflake repository as WORKSPACE_ADBC.md:

https://github.com/Snowflake-Labs/RSnowflake/blob/main/WORKSPACE_ADBC.md

Companion ML workflows

If you use snowflakeR in the same notebook, DBI access from R can share credentials via snowflakeR::sfr_dbi_connection(). See vignette("workspace-notebooks", package = "snowflakeR").