Skip to content

Conversation

@atheriel
Copy link
Contributor

This commit has two goals: (1) make the R code we generate for connecting to Snowflake tables look "idiomatic" and consistent with our broader effort to improve R's tooling for Snowflake; and (2) make it more closely match the simplicity of the Python code.

In line with this, the code has been completely rewritten to use the odbc::snowflake() helper and dplyr. This has a number of advantages:

  • We no longer have to worry about how authentication works, because we can delegate this to R. This mirrors what we do for Python already.

  • The generated code should work on Posit Workbench.

  • Users get automatic ODBC driver detection (a key feature of odbc::snowflake()) and dramatically better error messages in the R console.

  • We don't have to prompt users for their Snowflake username in the UI.

  • We can leverage dplyr's existing support for previewing tables without the need to manually LIMIT 10.

This also opens the door to picking up downstream improvements to odbc::snowflake() in support for Snowflake connection.toml files.

Finally, this change also includes a fix to the indentation of the generated R code, which otherwise looks very odd in the console.

A sense of what the new code looks like in practice:

Screenshot_2025-11-21_14-44-01

Release Notes

New Features

  • N/A

Bug Fixes

  • N/A

QA Notes

Please advise.

This commit has two goals: (1) make the R code we generate for
connecting to Snowflake tables look "idiomatic" and consistent with our
broader effort to improve R's tooling for Snowflake; and (2) make it
more closely match the simplicity of the Python code.

In line with this, the code has been completely rewritten to use the
`odbc::snowflake()` helper and `dplyr`. This has a number of advantages:

* We no longer have to worry about how authentication works, because we
  can delegate this to R. This mirrors what we do for Python already.

* The generated code should work on Posit Workbench.

* Users get automatic ODBC driver detection (a key feature of
  `odbc::snowflake()`) and *dramatically* better error messages in the R
  console.

* We don't have to prompt users for their Snowflake username in the UI.

* We can leverage `dplyr`'s existing support for previewing tables
  without the need to manually `LIMIT 10`.

This also opens the door to picking up downstream improvements to
`odbc::snowflake()` in support for Snowflake `connection.toml` files.

Finally, this change also includes a fix to the indentation of the
generated R code, which otherwise looks very odd in the console.

Signed-off-by: Aaron Jacobs <[email protected]>
@atheriel atheriel requested a review from isabelizimm November 21, 2025 20:17
@github-actions
Copy link

E2E Tests 🚀
This PR will run tests tagged with: @:critical

readme  valid tags

@isabelizimm
Copy link
Contributor

(FYI, failing test is unrelated)

Copy link
Contributor

@isabelizimm isabelizimm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for streamlining this code for R users! 🤩

@atheriel atheriel merged commit 9b855a4 into main Nov 24, 2025
11 of 12 checks passed
@atheriel atheriel deleted the aj-snowflake-r-codegen-improvements branch November 24, 2025 18:49
@github-actions github-actions bot locked and limited conversation to collaborators Nov 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants