-
Notifications
You must be signed in to change notification settings - Fork 7
Add role field to snowflake connector #74
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
- Added 'Role' field to clusterContext struct in snowflake.go. - Updated README to include 'role' configuration example for Snowflake plugin.
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.
Pull request overview
This pull request adds support for specifying a Snowflake role in the cluster configuration, allowing users to explicitly set which role should be used when connecting to Snowflake. If not specified, Snowflake will use the default role assigned to the user.
Key changes:
- Added
Rolefield to the Snowflake cluster configuration struct - Updated connection configuration to pass the role to the Snowflake driver
- Documented the new
rolefield in the README example
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
internal/pkg/object/command/snowflake/snowflake.go |
Added Role field to clusterContext struct and passed it to the Snowflake connection configuration |
plugins/snowflake/README.md |
Added role: MY_ROLE to the cluster configuration example |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hladush
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.
Fix comment and add testing description before merge
- Fixed typo in error message for invalid key type. - Added 'Role' field to commandContext struct for command-level role configuration. - Updated New function to parse command context from YAML config. - Revised README to clarify role configuration and its separation from cluster settings.
e55dc48
Testing SummaryChanges Tested
Test Environment
Test Cases
How to Reproduce# Build and start
cd heimdall
docker-compose up --build -d
# Test Case 1: With role specified
curl -X POST http://localhost:9090/api/v1/job \
-H "Content-Type: application/json" \
-H "X-Heimdall-User: test-user" \
-d '{
"name": "test-with-role",
"command_criteria": ["type:snowflake_copy"],
"cluster_criteria": ["type:snowflake"],
"context": {"query": "SELECT CURRENT_ROLE() as current_role"}
}'
# Test Case 2: Without role (default)
curl -X POST http://localhost:9090/api/v1/job \
-H "Content-Type: application/json" \
-H "X-Heimdall-User: test-user" \
-d '{
"name": "test-default-role",
"command_criteria": ["type:snowflake_default"],
"cluster_criteria": ["type:snowflake"],
"context": {"query": "SELECT CURRENT_ROLE() as current_role"}
}'
# Check results
curl http://localhost:9090/api/v1/job/{job_id}/resultConfiguration Examplecommands:
- name: snowflake_copy
plugin: snowflake
context:
role: DATA_ENGINEER_ROLE # Explicit role
tags:
- type:snowflake_copy
- name: snowflake_default_role
plugin: snowflake
# No role = uses user's default role (backward compatible)
tags:
- type:snowflake_defaultFiles Changed
|
This pull request adds support for specifying a
rolein the Snowflake command context, ensuring that the role is propagated through configuration, runtime, and documentation. This enhancement allows users to set the Snowflake role directly in their configuration files and ensures it is used during command execution.Enhancement: Snowflake role support
Rolefield to theclusterContextstruct insnowflake.goto allow specifying a Snowflake role in the configuration.snowflake.goto pass theRolevalue from the context to the Snowflake connection configuration.rolefield is optional. If not specified, Snowflake will use the default role assigned to the user.Documentation update
plugins/snowflake/README.mdto document the newrolefield in the configuration.