-
Notifications
You must be signed in to change notification settings - Fork 117
Use Snowflake config.toml/connection.toml files #975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add support for loading connection parameters from TOML config files (~/.snowflake/connections.toml and config.toml) following the Python Snowflake connector conventions. New features: - `connection_name` parameter to load a named connection profile - `connections_file_path` parameter to specify custom config location - Support for SNOWFLAKE_CONNECTIONS env var (full TOML override) - Support for SNOWFLAKE_DEFAULT_CONNECTION_NAME env var - File permission security checks (error on writable, warn on readable) - Graceful fallback when toml package not installed Connection resolution: - Case 1: connection_name provided → load and merge with kwargs - Case 2: No args → load default connection from config - Case 3: Programmatic params → use params only, skip config loading SNOWFLAKE_ACCOUNT env var is only used in Case 3 (programmatic mode), not when loading from config files. Requires the toml package (Suggests) for config file parsing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Two issues fixed: 1. When config file had `user` + `authenticator` (no password), the `uid` and `authenticator` values ended up in both `args` and `auth`, causing "formal argument matched by multiple actual arguments" error. Fixed by nulling auth params from `args` before merging with `auth`. 2. `snowflake_auth_args()` wasn't returning `authenticator` when using uid + authenticator (externalbrowser/SNOWFLAKE_JWT), so the authenticator from config file was lost and the "Failed to detect ambient credentials" error was thrown. Added tests for config files with user + authenticator (no password). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Two issues fixed: 1. SNOWFLAKE_CONNECTIONS env var was preventing reading of default_connection_name from config.toml. Now each config option is resolved independently, matching Python connector behavior. 2. Missing toml package gave misleading "connection not found" error instead of "toml package required" when config files existed. Now errors appropriately when TOML parsing is actually needed. Implementation uses delayedAssign() for lazy promise-based evaluation: - Only parses TOML sources that are actually needed - toml package error only triggers when parsing is required - Clean precedence logic via %||% chains, no complex conditionals 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
simonpcouch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have strong reflexes here on the big idea, but trust that this is a reasonable approach! Reviewing for R code style etc.
Could you add a NEWS entry?
|
Fine to ignore the two failing checks. |
cce831b to
34f87e1
Compare
simonpcouch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good🗃️
Vibe coded; just for discussion purposes for nowExtremely carefully reviewed by @jcheng5, except unit tests (life is too short)Add support for loading connection parameters from TOML config files (~/.snowflake/connections.toml and config.toml) following the Python Snowflake connector conventions.
New features:
connection_nameparameter to load a named connection profileconnections_file_pathparameter to specify custom config locationConnection resolution:
SNOWFLAKE_ACCOUNT env var is only used in Case 3 (programmatic mode), not when loading from config files.
Requires the toml package (Suggests) for config file parsing.
🤖 Generated with Claude Code