catalog-explorer: Improve generated R code for Snowflake tables #10720
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 anddplyr. 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 manuallyLIMIT 10.This also opens the door to picking up downstream improvements to
odbc::snowflake()in support for Snowflakeconnection.tomlfiles.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:
Release Notes
New Features
Bug Fixes
QA Notes
Please advise.